真是坑爹嗷嗷。。。。从c++ QT转过来学java。。。。这个内部类原来就是调用函数后,再调用函数里面的函数。。。。哎,想吐。。。。说简单点不好吗?非要说一堆名词出来。。。。吐槽完毕
2015-10-13
System.out.println("访问外部类中的score:" +HelloWorld.score );
System.out.println("访问内部类中的score:" + score);
}
}
// 测试静态内部类
public static void main(String[] args) {
// 直接创建内部类的对象
SInner si=new SInner();
System.out.println("访问内部类中的score:" + score);
}
}
// 测试静态内部类
public static void main(String[] args) {
// 直接创建内部类的对象
SInner si=new SInner();
2015-10-12
public static void show() {
HelloWorld hello = new HelloWorld();
System.out.println("姓名:" + hello.name + ",性别:" + hello.sex + ",年龄:" + age);
}
public static void main(String[] args) {
// 创建对象
// 调用对象的show方法
show();
}
HelloWorld hello = new HelloWorld();
System.out.println("姓名:" + hello.name + ",性别:" + hello.sex + ",年龄:" + age);
}
public static void main(String[] args) {
// 创建对象
// 调用对象的show方法
show();
}
2015-10-12
public static int sum() {
int score=score1+score2;
return score;
}
public static void main(String[] args) {
// 调用静态方法sum并接收返回值
int allScore = HelloWorld.sum();
System.out.println("总分:" + allScore);
}
}
int score=score1+score2;
return score;
}
public static void main(String[] args) {
// 调用静态方法sum并接收返回值
int allScore = HelloWorld.sum();
System.out.println("总分:" + allScore);
}
}
2015-10-11