Computer Science Canada

ASCII values

Author:  haz1487 [ Wed Nov 14, 2007 12:16 am ]
Post subject:  ASCII values

Hey I was wondering if there was a way of getting the ASCII value of a character in JAVA. Similar to the ord command in turing.

And if possible can you tell me how to print those values as characters?

Author:  zylum [ Wed Nov 14, 2007 2:04 am ]
Post subject:  RE:ASCII values

cast it to int and print that.

Author:  HeavenAgain [ Wed Nov 14, 2007 12:10 pm ]
Post subject:  RE:ASCII values

you are asking for ord, and yet you are asking "how to print those values as characters"

but cast to int and char will work for both cases Razz
code:
System.out.print((int)'a'+" "+(char)95);

casting rule! (sometimes)


: