It's not a secret anymore!*
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
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