這第一題怎麼打出來,怎麼用if實現?????
供參考
import java.util.Scanner;
public class AA {
static B b = new B();
/**
* @param args
*/
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int x = s.nextInt();
if (x > b.get()) {
System.out.println("大了");
} else if (x < b.get()) {
System.out.println("小了");
} else {
System.out.println("猜對了");
}
}
}
class B {
public int v = 100;
public int get() {
return v;
}
}