File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes why does it say undefined variable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "why does it say undefined variable" Watch "why does it say undefined variable" New topic
Author

why does it say undefined variable

Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
Please see the following code
class sample
{
public static void main(String args[])
{
int b = OxFF;
}
}
Why am I getting this error.OxFF is a valid hexadecimal literal right??
sample.java:6: Undefined variable: OxFF
int b = OxFF;
^
1 error

Paul A
Ranch Hand

Joined: Aug 25, 2000
Posts: 44
You have typed OxFF ( the letter 'O' ) instead of 0xFF (zero).
So the compiler thinks that it is some variable and tries to look up this varible in it's table but does not find it. So it says undefined variable!
HTH,
Paul.
------------------
http://pages.about.com/jqplus
Get Certified, Guaranteed!


<A HREF="http://pages.about.com/jqplus" TARGET=_blank rel="nofollow">http://pages.about.com/jqplus</A> <BR>Get Certified, Guaranteed!
 
 
subject: why does it say undefined variable
 
Threads others viewed
Public Variables
Method question
question from Mughal cert book
Another IO Question
Very very Very important to Understand this Inner class
developer file tools