true and false are keywords True and False are not. public class True // Will compile and print 11 { public static void main(String[] args) { int True = 11; System.out.println(True); } } public class True // Will not compile { public static void main(String[] args) { int true = 11; System.out.println(true); } } ------------------ Warren Bell
Hi Sarim, JLS §3.9 describes const and goto as being reserved as keywords. true and false are boolean literals; they are not keywords BUT cannot be used as identifiers. The same goes for null which is also a literal. The other words you listed are not keywords. Nor have I come across any mention of their being reserved. Try using them as identifier names; if the code compiles, they're not reserved. Hope that helps. ------------------ Jane The cure for boredom is curiosity. There is no cure for curiosity. -- Dorothy Parker
Dear Mathew In case of questions asked in JCP with the above given options you should only mark the following ones except ( true & false & null ) they are literals .
goto const [This message has been edited by Anand Yadav (edited December 30, 2000).] [This message has been edited by Anand Yadav (edited December 30, 2000).]
Hi Tom, When you have any doubts about which words are keywords, check the JLS§3.9. The words listed are the only keywords for Java. It also explains that goto and const are considered keywords; even though they are not currently used by the language and that true, false, and null are literals, not keywords, but, like keywords, they may not be used as identifiers ie variable, method, etc names. I have never seen any references to reserved words in the literature although I have seen it used on mocks. For exam purposes ... stick to the definitions given in the JLS. Hope that helps. ------------------ Jane The cure for boredom is curiosity. There is no cure for curiosity. -- Dorothy Parker