• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java <identifier> expected.  RSS feed

 
Abhishek Singh Rana
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



This is the code. It shows a <identifer> expected for each p1, p2 and p3 in the new.Player(); above.

I ran this code in my school on JDK 1.6 and it worked OK. Then I came home and ran it on JDK 1.8 and it was having issues. The same code. So this is the way I could get the least errors.

I tried naming the class to Player but then it did not identify the random in Math.random();.
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not new.Player()
It is new Player()
Because you had the . it looks as though you were using the keyword new as the name of an object.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!