Results 1 to 1 of 1
-
Printing ASCII values of characters
The code snippet below displays the ASCII value of each character of a String.
Output:Java Code:String str = "Java practice session. "; for (int i=0; i<str.length();i++) System.out.println(str.charAt(i) + " as ASCII value of: " + (int)str.charAt(i) );
Java Code:J as ASCII value of: 74 a as ASCII value of: 97 v as ASCII value of: 118 a as ASCII value of: 97 as ASCII value of: 32 p as ASCII value of: 112 r as ASCII value of: 114 a as ASCII value of: 97 c as ASCII value of: 99 t as ASCII value of: 116 i as ASCII value of: 105 c as ASCII value of: 99 e as ASCII value of: 101 as ASCII value of: 32 s as ASCII value of: 115 e as ASCII value of: 101 s as ASCII value of: 115 s as ASCII value of: 115 i as ASCII value of: 105 o as ASCII value of: 111 n as ASCII value of: 110 . as ASCII value of: 46 as ASCII value of: 32
Similar Threads
-
How to obtain ASCII code of a character
By karma in forum New To JavaReplies: 4Last Post: 07-20-2008, 02:57 AM -
Accessing boolean Values of another values in one class.
By a_iyer20 in forum Advanced JavaReplies: 4Last Post: 04-15-2008, 01:04 PM -
Printing default Swing values
By Java Tip in forum Java TipReplies: 0Last Post: 03-12-2008, 11:09 AM -
Getting ASCII codes of character
By gapper in forum New To JavaReplies: 1Last Post: 02-02-2008, 09:42 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks