• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java reserved keywords

 
Shafeeq Sheikh
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys....
In Bill Brodgen's book exam cram, he mentions that cast, future,
generic, inner, operator,outer are all reserved keywords that cannot be used. (pg 16)
While I wrote a small piece of code where I used these successfully.
public class Test{
static int cast = 5;
static int future = 6;
static int generic = 7;
static int inner = 8;
static int operator = 9;
static int outer = 10;
public static void main(String args[]){
System.out.println(Test.cast);
System.out.println(Test.future);
System.out.println(Test.generic);
System.out.println(Test.inner);
System.out.println(Test.operator);
System.out.println(Test.outer);
}}
Am I missing something here???
Thanks....
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Authorized java site for key words and reserved words
for Java 2....hopefully you are preparing for SCJP2...
Java Language Keywords
A previous discussion on this topic ...
http://www.javaranch.com/ubb/Forum24/HTML/001532.html

Regds.

- satya
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The story on that reserved word table in my books is this:
I was depending on the information in the Java in a Nutshell book which I re-organized for that table. It turned out that Flannagan re-used information from the pre-JDK 1.02 release of Java in which there were a lot of words reserved by the design team.
Sun changed the reserved word list BUT did not mention the change in the release documents so both Flannagan and I published an obsolete list. Anybody using the Java 2 Exam Cram or Java 2 Exam Prep books should get the errata from: http://www.lanw.com/books/errata/
which I try to keep up to date.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic