• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

confusion with the question

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This question is confusing me, The question is
to find out the reserved word or keyword?
Because, if i am right, reserved words are const,goto. there is no reserved words in the question below.........

Which is a reserved word in the Java programming language? (Choose one.)
A. method
B. native
C. subclasses
D. reference
E. array
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

to find out the reserved word or keyword?


Notice the or.There's no reserved word here. The only keyword is native
[ July 25, 2003: Message edited by: Andres Gonzalez ]
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andres,
could you plz tell me difference between native and reserved word. Even I'm having difficult time in figuring out this. I assume that both are same. But with your remarks I guess its different?
Thanks
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Priyanka
difference between native and reserved word
i assume u meant- difference b/w keyword and reserved word.
1. keyword word - u can use it as variable names
e.g. String. u can say,
String String = new String("Priyanka");
2. reserved word - u can't use it as variable names
e.g. u can't say,
int for = 0;
u get it?
regards
maulin
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JLS 3.9 Keywords
I think I see where you got confused with this line "The keywords const and goto are reserved, even though they are not currently used. " This is not saying that const and goto are the only reserved words, it is saying that they are the only reserved words that are not currently used. All keywords are reserved words.
 
Darren McLeod
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Maulin Vasavada:
hi Priyanka
difference between native and reserved word
i assume u meant- difference b/w keyword and reserved word.
1. keyword word - u can use it as variable names
e.g. String. u can say,
String String = new String("Priyanka");
2. reserved word - u can't use it as variable names
e.g. u can't say,
int for = 0;
u get it?
regards
maulin


Maulin, String is not a keyword. Keywords are reserved and cannot be used as variable names.
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All keywords are reserved words.
But all reserved words are not used very often eg: const and goto.
 
Priyanka Chopda
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok! can I assume safely that
-All keywords are reserved words.
-Reserved words cannot be used as variables and hence keywords!
Am I correct?
Thanks
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another tip. keywords are always small case (even the first letter). So when you see a question regarding keywords and options like "Native" (notice the capital "N"), you can discard it immediately.
and this is from KnB book


Keywords are special reserved words in Java that you cannot use as identifiers (names) for classes, methods, or variables

 
reply
    Bookmark Topic Watch Topic
  • New Topic