Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes how come its compiling?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "how come its compiling??" Watch "how come its compiling??" New topic
Author

how come its compiling??

srikanth reddy
Ranch Hand

Joined: Jul 28, 2005
Posts: 252


there are no single quotes to indicate that its a character...
i have compiled it ..its compiling ...can anyone explain me??


Thanks & Regards<br /> <br />-Srikanth
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Can I suggest you read about the stages involved in compiling a program?
What is the character set that the compiler uses to read source code?
What character is \u0038?
That is, what character does the compiler see in its input stream?
Print the value of the float number to see what you get at run time.
[ October 25, 2005: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
patrick J. d'cousta
Greenhorn

Joined: Oct 25, 2005
Posts: 24
Srikanth i think 38 must be the ascii vallue of some number.So \u0038 will be replaced by the ascii value say 4.Hence its compiling fine.
Srinivas Kalvala
Ranch Hand

Joined: Oct 20, 2005
Posts: 257

Originally posted by srikanth reddy:


there are no single quotes to indicate that its a character...
i have compiled it ..its compiling ...can anyone explain me??


It is very simple,
the java compiler simple doing the down casting for that ... that is storing the int to the float , so it wont give any error.
but when you try to print the value , you may not get the exact value due to the automatic down casting.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how come its compiling??
 
Similar Threads
Marcus Green Exam 3, Question 57
Switch statement
Head First Java Frustration!
local variable not assigned any value in a method yet how does it compile??
JAVA SCJP Master Exam dowhile loop