This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

error message  RSS feed

 
Wolfgang Obi
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello folks,

can someone tell me why i keep on getting this error message ?:

java:13: <identifier> expected
System.out.println("Please enter either Ja or Nein.. :");


this is a segment of the code i'm trying to compile...



thank you.
 
Stephen Foy
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your array is type object
 
Wolfgang Obi
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx for the reply, but im getting the same error message if i use:

static String[] yesGroup = {"ja", "j", "y", "yes", "yeah"};
static String[] noGroup = {"nein", "n", "no", "nah"};

what am i doing wrong?
 
Stephen Foy
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have a statement like, System.out inside the class scope. Dont you have a main method?


[ May 27, 2006: Message edited by: Stephen Foy ]
 
Wolfgang Obi
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Stephen Foy...

I'm sure u meant "can't"

thanx, fixed it!
 
Stephen Foy
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes sorry was a typo
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to clarify: A String is an Object, so it's perfectly fine to assign Strings as elements of an Object array. The references in the array are simply upcast to type Object.
 
Stephen Foy
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by marc weber:
Just to clarify: A String is an Object, so it's perfectly fine to assign Strings as elements of an Object array. The references in the array are simply upcast to type Object.


Yea i realised that after i read about it, i just had never seen an array of type Object[] before
[ May 27, 2006: Message edited by: Stephen Foy ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!