java程序纠错1

来源:百度知道 编辑:UC知道 时间:2024/05/09 12:11:57
class Excep1
{
public int A(int a.int b)
{
return a/b;
}
}
class test1
{
public static void main(String[]args)
{
Excep1 excep=new Excep();
excep.A(5,1);
System.out.println("完成");
}
}

第一,public int A(int a.int b)
参数使用逗号分开,不是用点号分开

第二Excep1 excep=new Excep();
改为Excep1 excep=new Excep1();
要和类名一样
改好程序如下

class Excep1
{
public int A(int a,int b)
{
return a/b;
}
}
class test1
{
public static void main(String[]args)
{
Excep1 excep=new Excep1();
excep.A(5,1);
System.out.println("完成");
}
}