• Post Reply Bookmark Topic Watch Topic
  • New Topic

for loops in java  RSS feed

 
adebari olalekan
Ranch Hand
Posts: 61
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone please help with this?




i think the code is good but i keep getting this error:

 
Ganesh Patekar
Bartender
Posts: 726
23
Eclipse IDE Hibernate jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
adebari olalekan wrote:Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Such error occurs when you run a code when there is compile time error in your code and IDE shows that still you run that code then you get that error. Please check the red mark If there is any just hover mouse on the red mark to know what causing compile time error.
I ran your code successfully also got output, perhaps you named   .java file something else than Forloops, just check that...
Edit: Which IDE are you usig to run this program? What is compiler compliance level is set to ?
I think It needs at least 1.5 because printf was introduced in 1.5. printf() method.
 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also compiled and executed this code without error.

If you're compiling from the command line, can you post the exact command?
 
adebari olalekan
Ranch Hand
Posts: 61
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ganesh Patekar wrote:
adebari olalekan wrote:Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Such error occurs when you run a code when there is compile time error in your code and IDE shows that still you run that code then you get that error. Please check the red mark If there is any just hover mouse on the red mark to know what causing compile time error.
I ran your code successfully also got output, perhaps you named   .java file something else than Forloops, just check that...
Edit: Which IDE are you usig to run this program? What is compiler compliance level is set to ?
I think It needs at least 1.5 because printf was introduced in 1.5. printf() method.


thanks everybody, i later discovered that my is 1.8 and the corresponding in eclipse is 1.7, so things got a confused,so i had to delete my eclipse and download the latest version for
 
Ganesh Patekar
Bartender
Posts: 726
23
Eclipse IDE Hibernate jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
adebari olalekan wrote: i had to delete my eclipse and download the latest version for
I'm not sure but I think you just had to add JRE 8 to the installed JREs and set compiler compliance to 1.8 in windows --> preference. Did It work?
 
adebari olalekan
Ranch Hand
Posts: 61
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ganesh Patekar wrote:
adebari olalekan wrote: i had to delete my eclipse and download the latest version for
I'm not sure but I think you just had to add JRE 8 to the installed JREs and set compiler compliance to 1.8 in windows --> preference. Did It work?

YES, it works perfectly, i later discovered that if the jre on eclipse is not in accordance with the one on the system, some methods will not work
 
Ganesh Patekar
Bartender
Posts: 726
23
Eclipse IDE Hibernate jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ohh, Good to know It worked
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!