desiigner
desiigner

Reputation: 89

Java Program not running; error box is blank?

sorry if this question was repeated earlier, but I couldnt seem to find the answer. I have a code:

import java.util.Scanner;
public class PracticeProblems {
    public static void main(String[] args) {
        int x;
        Scanner input = new Scanner(System.in);
        System.out.println("Enter a number: ");
        x= input.nextInt();
        if(x%2 == 0) {
            System.out.println(x%2==0); 
        }
        else {
            System.out.println(x%2==0);
        }


    }

}

Now I am not too worried if the code actually works or not (because this same problem has occurred when the code was perfectly functional) I am just as confused why it doesnt run. ERROR BOX

Upvotes: 1

Views: 2848

Answers (3)

Super Villain
Super Villain

Reputation: 1

I have faced similar problems many times.

To solve this problem save the program, close Eclipse, reopen it and run the program without any loss of the program.

It works fine.

Upvotes: 0

Niton
Niton

Reputation: 306

I had a similar problems too.

  1. Eclipse > Projects > Clean
  2. if its not working try to copy the class. Delete the Project and recreate it

Upvotes: 1

Dave Drake
Dave Drake

Reputation: 333

Try running by right clicking on PracticeProblems.java, and choosing "Run As Application". It looks like it is trying to run ComputeArea, and can't find that class.

Upvotes: 1

Related Questions