我学过C++的 现在跳着学JAVA呢 可是编译通过不能运行
public class test1{
int a;
char b;
public void max(int a,int b)
{
System.out.println(a>b? a:b);
}
public void main(String[] args){
test1 t= new test1();
t.max(3,4);
}
}
运行就提示
Exception in thread “main” java.lang.NoSuchMethodError:main
很菜的问题
public class test1{
int a;
char b;
public void max(int a,int b)
{
System.out.println(a>b? a:b);
}
public void main(String[] args){
test1 t= new test1();
t.max(3,4);
}
}
运行就提示
Exception in thread “main” java.lang.NoSuchMethodError:main
很菜的问题
int a;
char b;
public void max(int a,int b)
{
System.out.println(a>b? a:b);
}
public static void main(String[] args){
Test1 t= new Test1();
t.max(3,4);
}
}
可以运行
Java中static、this、super、final用法
我才找的 以前一直都是用 public static void main(String【】 arge)
都没想过 static的用处... 大家看看会有帮助的