Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Keywords!

 
sabyasachi mondal
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I have a confussion! Please follow:
(a) Boolean
(b) BOOLEAN
(c) boolean
I know (c) is a keyword but what about (a) and (b)?
Thanks for your reply.
regds,
mondal
 
Tom Tang
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, remember all the Java keywords are lowercase. So you know immediately, there'is only one possible answer.
Secondly, check the most authoritative Java keyword list at JLS 3.9. Disregard all other lists after memorizing this one.
 
sabyasachi mondal
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tom Tang:
First of all, remember all the Java keywords are lowercase. So you know immediately, there'is only one possible answer.
Secondly, check the most authoritative Java keyword list at JLS 3.9. Disregard all other lists after memorizing this one.

Thank you Tom. Tom I see that I am still in dbt with the keywords
goto and const. RHE books says they are reserved but have no meaning in Java. Would you please help further?
 
Tom Tang
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
goto and const are reserved but not used, so you can't use them as varible names. Just think of them as spare tires.
 
Tom Tang
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to JLS, The keywords const and goto are reserved, even though they are not currently used. This may allow a Java compiler to
produce better error messages if these C++ keywords incorrectly appear in programs.
 
sabyasachi mondal
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tom Tang:
According to JLS, The keywords const and goto are reserved, even though they are not currently used. This may allow a Java compiler to
produce better error messages if these C++ keywords incorrectly appear in programs.

Thank you again.
So still in the jexam2 (if any) I can say that goto is a reserved word.

 
chinmay naidu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But what about cast .Is it key word?In some books it mentioned that it is a key word.Also I am having doubt reg true ,false and null .Actually these are literals.Shall we consider them as KEYWORDS ?i.e.,If these options are included in multiple choices of identifing key words.
 
Beginner Ben
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOrry for my naive question. What exactly does JLS mean? I heard it a lot. Is it a book? And where can I find it.
thanks a lot
Ben
 
Morgan Subram
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JLS - Java Language Specification
URL :
http://java.sun.com/docs/books/jls/html/index.html
Cheers
 
Beginner Ben
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, Morgan. have a great weekend
Ben
 
david brafford
Greenhorn
Posts: 7
 
Jason Stortz
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may be wrong here, but back to the original question of:
BOOLEAN
Boolean
boolean
(or something like this)
java is case sensitive so if I was taking the exam I would look at this and think I knew boolean was correct, but that it couldn't be the other two because then they would be something different.
Maybe that's looking into it too much, and there is nothing stoping them from making those keywords as well just cause they can, though they aren't as far as I know.
Just rambling.
 
Rajpal Kandhari
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mondal,
"Keywords are reserved words but reserved words are not keywords."
Correct me if i am wrong on this:
There are 50 Keywords is java. Out of which const and goto are reserved keywords word not currently in use. Three identifiers are reserved as predefined literals (A literal denotes a constant value) in the language: null, true, false.
But for the purposse of exam: null, true and false could be taken as keywords because they have some pre-defined meaning and use in java.
Regards
Raj.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic