编程改错题(写出错误原因及改法)
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/06/24 05:39:35
编程改错题(写出错误原因及改法)
改错题(写出错误原因及改法)
1.
class Test1
{
int i=99;
viod abc(){
System.out.println(i);
}
public static void main(String[] args){
abc();
}
}
2.
class A
{
int i;
void A(int i)
{
this.i=i;
}
}
class Test
{
void f( )
{
A a= new A( );
System.out.println(a.i);
}
}
3.
class A
{
private int m=10;
protected int n=20;
}
class B extends A
{
int m=100;
int n;
}
class Test
{
void f( )
{
A a=new A();
A b=new B();
System.out.println(a.m);
System.out.println(a.n);
System.out.println(b.m);
System.out.println(b.n);
}
}
改错题(写出错误原因及改法)
1.
class Test1
{
int i=99;
viod abc(){
System.out.println(i);
}
public static void main(String[] args){
abc();
}
}
2.
class A
{
int i;
void A(int i)
{
this.i=i;
}
}
class Test
{
void f( )
{
A a= new A( );
System.out.println(a.i);
}
}
3.
class A
{
private int m=10;
protected int n=20;
}
class B extends A
{
int m=100;
int n;
}
class Test
{
void f( )
{
A a=new A();
A b=new B();
System.out.println(a.m);
System.out.println(a.n);
System.out.println(b.m);
System.out.println(b.n);
}
}
![编程改错题(写出错误原因及改法)](/uploads/image/z/8666592-24-2.jpg?t=%E7%BC%96%E7%A8%8B%E6%94%B9%E9%94%99%E9%A2%98%28%E5%86%99%E5%87%BA%E9%94%99%E8%AF%AF%E5%8E%9F%E5%9B%A0%E5%8F%8A%E6%94%B9%E6%B3%95%29)
1.没有实例化abc()所在类 改法,先实例化 Test1 ts=new Test1();
ts.abc()
2.i不是公共变量不能在外面访问,在声明的时候改为public int i
3.类A中的m和B的n不能在外面 访问去掉
System.out.println(a.m);
System.out.println(b.n);
ts.abc()
2.i不是公共变量不能在外面访问,在声明的时候改为public int i
3.类A中的m和B的n不能在外面 访问去掉
System.out.println(a.m);
System.out.println(b.n);
编程改错题(写出错误原因及改法)
英语改错,请附带改题思路及原因
请教一道有争议的英语改错题,说说你的改法(一处错误),并详细说明原因
短文改错及原因
求高手改英语作文帮忙找出错误及原因,写出修改后的结果.My View on the Post-graduate Craz
请问有谁帮我解答一下以下英语的单句改错题,要求有二:1.指出错误选项并改正 2.写出错误原因,
改错(一共有四处错误,把改完的句子写出来)
修改病句 写明原因及改法
语文改错题【要求说出错误的地方,原因】急!
一道英语改错题,有一处错误,讲清楚原因.
英语改错单句改错(一处错误)I have the same idea as his.麻烦写出详细原因,
英语改错题,最好能说出这样改的原因