我是Java的初学者,当我编译下面的代码时,我得到:
Error: Could not find or load main class
这是我的代码:
import java.util.Scanner;
public class Comparision {
public static void main(string[] args) {
Scanner j = new Scanner(System.in);
int a,b;
System.out.println("enter the value for a");
a = j.nextInt();
System.out.println("enter the value for b");
b = j.nextInt();
if(a > b)
System.out.println("a is greater");
else
System.out.println("b is greater");
}
}
答案 0 :(得分:2)
import java.util.Scanner;
public class Comparision {
public static void main(String[] args)
{
Scanner j=new Scanner(System.in);
int a,b;
System.out.println("enter the value for a");
a=j.nextInt();
System.out.println("enter the value for b");
b=j.nextInt();
if(a>b)
{
System.out.println("a is greater");
}
else
System.out.println("b is greater");
}
}
字符串不是字符串// java类以大写字母开头
答案 1 :(得分:0)
java是一个区分大小写的语言......
这个
public static void main(string[] args)
与此不一样......
public static void main(String[] args)
准确查看参数......
并看到字符串与字符串不一样...