• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What would be the command line argument be?

 
Simon Joseph Aquilina
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created the following example in D.java



I always assumed that to run a java program both class and main method must be public. However eclipse allows me to start either D1 or D2.

What would be the command line argument to start a program from the main method in for example class D1 which is defined in the file D.java?


 
Stephan van Hulst
Bartender
Pie
Posts: 5599
55
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java D1
 
Matthew Brown
Bartender
Posts: 4566
8
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you'll find is that although these are both in the source file D.java, the compiled files will be D1.class and D2.class.
 
Simon Joseph Aquilina
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew Brown wrote:What you'll find is that although these are both in the source file D.java, the compiled files will be D1.class and D2.class.


You are right, you are right!!! ... I should be ashamed of myself!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic