Forums Register Login

for loops in java

+Pie Number of slices to send: Send
can someone please help with this?




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

1
+Pie Number of slices to send: Send
 

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.
1
+Pie Number of slices to send: Send
I also compiled and executed this code without error.

If you're compiling from the command line, can you post the exact command?
+Pie Number of slices to send: Send
 

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
1
+Pie Number of slices to send: Send
 

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?
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
Ohh, Good to know It worked
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 404 times.
Similar Threads
New Boston tutorial #16 - getting an error
Parameters and Function
Hi, Need Help With this basic program
Error in using "assert" in java program....
Constructors Compile Error
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:31:19.