Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

case???

 
sonir shah
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means case is reserved word!!
case should be followed by a literal
-Arsho
 
sonir shah
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means that any reserved key should be followed by a literal orelse it will give a compiler error?
Sonir
 
Arsho, Ayan
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 417
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic