• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Errors + for loops.  RSS feed

 
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.



 
Master Rancher
Posts: 3276
33
  • 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!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!