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

char problem

Kunal Choudhary

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

public static void main(String args[])

char x='51';



why error???
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374

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:
subject: char problem
Similar Threads
4m Dan's Exam
Assigning to char
Number Format
Number Formatting