So I'm trying to master java and this book I have by herb schildt is good one of the best as a matter of fact and I'm having a problem with eclipse (this program compiles on the cmd ln) but I am getting this error in eclipse when I try to run it…
"Selection does not contain a main type."
/*
Demonstrate the If.
Call this file IfDemo.java.
*/
class IfDemo {
public static void main(String args[]) {
int a, b, c;
a = 2;
b = 3;
if(a < b) System.out.println("a is less than b");
// This wont display anything.
if(a == b) System.out.println("you won't see this");
System.out.println();
c = a - b // -1
System.out.println("c contains -1.");
if(c >= 0) System.out.println("c is non-negative.");
if(c < 0) System.out.println("c is negative");
System.out.println();
c = b - a; // c now contains 1.
System.out.println("c now contains 1.");
if(c >= 0) System.out.println("c is non-negative.");
if(c < 0) System.out.println("c is negative.");
}
}