Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Weird errors

 
Caleb Alien
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I'm not exactly "new" to java or the programming scene but I've never seen this error before. I'm new to eclipse so maybe that's it.
Here's my code

When I run as java application I get ," Selection does not contain a main type".

Any help?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I'm not exactly "new" to java or the programming scene

Maybe you're trying to execute this class which does not have a main method ?
 
Caleb Alien
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I check this?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Your class is called Main. There's a constructor-like method called RandomNumberGame but it does not fit the class name. Unless you wanted to call the method "randomNumberGame" ? It looks like you're confusing the concept of having a main method and naming a class "Main". Naming a class "Main" is not going to make it the entry point of your program.

Read more about the main method here.
 
Caleb Alien
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that fixed it ( making a new class that wasn't stupid ).

 
Campbell Ritchie
Sheriff
Pie
Posts: 49756
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
…and welcome to the Ranch
 
Caleb Alien
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks man
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic