[730] in java-interest

home help back first fref pref prev next nref lref last post

Re: question on charAt

daemon@ATHENA.MIT.EDU (Chuck McManis)
Mon Jul 17 19:05:11 1995

Date: Mon, 17 Jul 1995 14:50:24 -0700
From: cmcmanis@scndprsn.Eng.Sun.COM (Chuck McManis)
To: Cheng.Huang@Eng.Sun.COM
Cc: java-interest@java.Eng.Sun.COM


The char value was promoted to an int and printed. You can either
change this to:

	String mystr = "HotJava";
	System.out.println("mystr.charAt(1) = " + mystr.substring(1,1));

or use a StringBuffer like so :

	String mystr = "HotJava";
	StringBuffer sb = new StringBuffer();

	sb.appendChar(mystr.charAt(1));
	System.out.println("mystr.charAt(1) = "+sb);

In the future the char type will probably _not_ be a numeric type so
your original statement could work as you expected.

--Chuck	

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post