• Post Reply Bookmark Topic Watch Topic
  • New Topic

Errors + for loops.  RSS feed

 
Bod McLeon
Ranch Hand
Posts: 78
IntelliJ IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So starting off, is there a way to do a loop that goes on forever until a number gets below zero?
Secondly why does it always say 'Illegal type 'void'' when doing public static void main (String[] args)
Lastly I get this message all the time:


(Please don't worry about my code being messy, I will clean it up!)
Heres my code so hopefully you can figure something out.



 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why does it always say 'Illegal type 'void''

Methods must be defined inside of a class.

java.lang.NoSuchMethodException: Pokemon.main([Ljava.lang.String;)

The Pokemon class needs to have a main() method. See above remark.

do a loop that goes on forever until a number gets below zero? 

A while loop can do that:
 
Bod McLeon
Ranch Hand
Posts: 78
IntelliJ IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norm Radder wrote:
why does it always say 'Illegal type 'void''

Methods must be defined inside of a class.

java.lang.NoSuchMethodException: Pokemon.main([Ljava.lang.String;)

The Pokemon class needs to have a main() method. See above remark.

do a loop that goes on forever until a number gets below zero? 

A while loop can do that:

Thanks! That got rid of all of my errors!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!