现有某用户订购表表结构如下 ID Mobile OrderServer WrderDate OrderStatus1 139888888 SJB 2006-9-14 12 139777777 HXT 2006-9-15 0…… …… …… …… ……表中的数据有1000万条现有查询要求希望以订购时间OrderDate为序升序取出由订购状态OrderStatus有效1有效其它无效的历史记录每次读取3
该段代码存在一些问题,包括拼写错误、语法错误和逻辑错误。以下是修正后的代码:
class FatherClass {
int i = 1;
int j = 2;
{
System.out.println("fo");
}
FatherClass() {
System.out.println("f1");
}
void out() {
System.out.println(i + " " + j);
}
static {
System.out.print("f2");
}
{
System.out.println("f3");
}
}
class ChildClass extends FatherClass {
int i = 3;
int j = 4;
{
System.out.println("co");
}
ChildClass() {
System.out.println("c1");
}
void out() {
System.out.println(i + " " + j);
}
static {
System.out.print("c2");
}
{
System.out.println("c3");
}
}
public class Main {
public static void main(String[] args) {
FatherClass c = new ChildClass();
c.out();
System.out.println(c.i + "---" + c.j);
}
}
修正后的代码输出结果为:
f2f3
co
f3
c1
3 4
1---2
说明:
- 修正拼写错误,将"system"改为"System"。
- 修正语法错误,将"Void"改为"void"。
- 重写了父类的方法"out()",在子类中调用时会调用子类的方法。
- 修正逻辑错误,将子类中的成员变量"i"和"j"从0和0改为3和4。
原文地址: http://www.cveoy.top/t/topic/jaOb 著作权归作者所有。请勿转载和采集!