• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Could someone tell me why my code will not run?

 
kenny gill
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have my system.out.println() filled out but I can't run the console at all and I'm not sure why. Any help is appreciated



Main class:

 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kenny gill wrote:
I have my system.out.println() filled out but I can't run the console at all


What exactly does "can't run the console" mean? You need to TellTheDetails(←click) because ItDoesntWorkIsUseless(←click).
 
kenny gill
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I meant that I can not choose the option 'run application' from Run-as. Sorry about that :S I'll format my question better next time I make a thread
 
Matthew Brown
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kenny gill wrote:I meant that I can not choose the option 'run application' from Run-as.

So you're using a specific IDE, then? Which one?

What IDEs are usually looking for to run a class as an application is an entry point - a public static void main(String[]) method. I don't see one in your code, so that's probably the problem.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your posted code is(are) two Java objects.

There is nothing to "run".

WP
 
Kristoffer Strijdonck
Greenhorn
Posts: 1
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have no main class.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49827
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

You mean no main method. Some people think it is poor style to have a class called Main. Other people think it is good style to have a class called Main. I am staying neutral, but never create classes called Main myself.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic