my dog learned polymorphism*
The moose likes Threads and Synchronization and the fly likes Could not find or load Error in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Could not find or load Error in java" Watch "Could not find or load Error in java" New topic
Author

Could not find or load Error in java

Sky Mendoza
Greenhorn

Joined: Jan 11, 2013
Posts: 9
I am able to compile it but I cant let it run. I dont even know if the code I did is right or what. But here it is:
public class OddOrEven{
public static void main(String []args){
int x = 1;
if (x > 1000){
if (x < 1){
System.out.println("Accepted");
}else if (x < 1000){
System.out.println("Error");
}else if (x > 1){
System.out.println("Error");
if (x % 2 == 0){
System.out.println("Even");
}else{
System.out.println("Odd");
}
}
}
}
}




I should make a code that only accepts 0-1000 else print error then it should show if it is even or odd. Thanks in advance and sorry for my english. Haha
Vijay Vishwa
Greenhorn

Joined: Nov 21, 2010
Posts: 28
Hi Combi,

Please do use the code tag by clicking on the code button. It will make the code readable and give response.



SCJP 5.0 OCBCD 5.0(Formerly SCBCD)
Vijay Vishwa
Greenhorn

Joined: Nov 21, 2010
Posts: 28
Regarding you question.

The first if condition is wrong itself.
If you want ot accept values between 0 and 1000(both inclusive) then it should be
Sky Mendoza
Greenhorn

Joined: Jan 11, 2013
Posts: 9
Oh thanks. Im not really good at programming because i'm only 1st year college.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Could not find or load Error in java
 
Similar Threads
help me
Having problem with Even/odd program
Please exlain this code
Need help
DEbugging