• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mysterious ways java?  RSS feed

 
Kerry Cotter
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HOW DO I GET THE FOLLOWING PROGRAM TO THE FOLLOWING RESULTS?!


RUNNING THE PROGRAM GETS:

Hello, World
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You compile it, run it and then type "Hello, World" at the command line followed by the enter key.
 
Kerry Cotter
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony Docherty wrote:You compile it, run it and then type "Hello, World" at the command line followed by the enter key.


What happens is it compiles and when I run it I get "Hello World" on the command line. There is no opportunity to hit enter as you can see.

[javadoc]Kerry-Cotters-iMac:introcs kcotter01$ javac HelloWorld.java
Kerry-Cotters-iMac:introcs kcotter01$ java HelloWorld
Hello, World
Kerry-Cotters-iMac:introcs kcotter01$ [/javadoc]

Does this program just state the name of the file?

 
Charles D. Ward
Ranch Hand
Posts: 99
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kerry Cotter wrote:
Does this program just state the name of the file?



The name of the file should be the same name of the class, so no.

I compiled and ran your code and it does exactly as expected: it waits until the user inputs something from the keyboard and then prints it out again.
 
Jayesh A Lalwani
Rancher
Posts: 2762
32
Eclipse IDE Spring Tomcat Server
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the name of your class is SimpleIO, why are you compiling and running HelloWorld? Maybe you should compile and run SimpleIO?

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!