Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how come its compiling??

 
srikanth reddy
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


there are no single quotes to indicate that its a character...
i have compiled it ..its compiling ...can anyone explain me??
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
patrick J. d'cousta
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 257
Firefox Browser Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic