aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes case??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "case???" Watch "case???" New topic
Author

case???

sonir shah
Ranch Hand

Joined: Nov 01, 2001
Posts: 435

I tried running this program but it didnt compile.
The error was as follows:
Test003.java:6 : orphaned case
case
^
1 error
What do we mean by this?
Sonir
Arsho, Ayan
Ranch Hand

Joined: Nov 14, 2001
Posts: 60
It means case is reserved word!!
case should be followed by a literal
-Arsho
sonir shah
Ranch Hand

Joined: Nov 01, 2001
Posts: 435
It means that any reserved key should be followed by a literal orelse it will give a compiler error?
Sonir
Arsho, Ayan
Ranch Hand

Joined: Nov 14, 2001
Posts: 60
Sonir :
Use a IDE for writing programs, you will know which to use and which not to.
There is a Textpad available freely, which you can write small programs and run it easily.
-A
Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
Sonir :
It means that you can not use reserved words as labels for loops.
In general reserved words ( in any programming language) can not be used for any other purpose besides what they are defined as .
So you can not write code such as
for ( int case =1; case < boolean; case ++)
or if ( while > do ) { //some code }
HTH
mark stone
Ranch Hand

Joined: Dec 18, 2001
Posts: 417
code is fine only change the word case to somthing else like test1 or hello or sing
case is a reserved word for the compiler.
x=0 y=0
x=1 y=0
Originally posted by sonir shah:

I tried running this program but it didnt compile.
The error was as follows:
Test003.java:6 : orphaned case
case
^
1 error
What do we mean by this?
Sonir
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: case???