This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes char problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "char problem" Watch "char problem" New topic
Author

char problem

Kunal Choudhary
Greenhorn

Joined: Feb 25, 2009
Posts: 14
public class testoperator
{

public static void main(String args[])
{

char x='51';

System.out.println(x);

}


}
why error???
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
Kunal,

I think you are trying to achieve ,
char x=51; // This is equivalent to 3 (ASCII)

'51' can't fit into single character.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: char problem
 
Similar Threads
4m Dan's Exam
Assigning to char
java.lang.OutOfMemoryError
Number Format
Number Formatting