• Post Reply Bookmark Topic Watch Topic
  • New Topic

runing .class  RSS feed

 
Prince Banga
Greenhorn
Posts: 3
Android Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I used javac on this and got a class file. I run it in cmd with java but nothing happens, no error message, and it wont let me type in cmd so I have to Ctrl c.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your program contains an infinite loop, line 4:

Note the ; at the end, which acts as an empty statement. What this line means is: "as long as x is greater than one, do nothing". It's a loop that just keeps checking if x is greater than one, doing nothing.

Remove the ;. Put the statements that are supposed to go in the body of the loop between { and }. Indent your code properly, so that it's easier to see the structure.
 
Liutauras Vilda
Sheriff
Posts: 4928
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prince Banga wrote:

Prince Banga, it is worth to mention, that Java class names suppose to start with a Uppercase.
Following the right Java convention is a good coding practice and makes your code more readable.
If it were an exercise to find and fix the bugs, pointing out to a nonconventional class name could be a good start
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!