static int score1 = 86;
int score2 = 92;
public static int sum() {
HelloWorld qwe = new HelloWorld();
int qwer=score1+qwe.score2;
return qwer;
}
public static void main(String[] args) {
int allScore=sum();
System.out.println("总分:" + allScore);
int score2 = 92;
public static int sum() {
HelloWorld qwe = new HelloWorld();
int qwer=score1+qwe.score2;
return qwer;
}
public static void main(String[] args) {
int allScore=sum();
System.out.println("总分:" + allScore);
2017-09-20
最赞回答 / qq_每日一啸_0
是想说 Tclass tclass=new tclass() 这是tclass就是创建的类的对象 ,类名为Tclass tclass.getclass() 用创建的对象调用getclass()的返回值就是类对象
2017-09-20
为什么封装?这么说吧,你买台电视,你是希望通过遥控按几个按钮就可以控制电视还是直接用一堆密密麻麻的电路板控制?封装的思想隐藏了具体实现的细节,用户只需了解使用的方法就行了,这样就算出错,也只用在用户层面的代码修改就行,而且用户可以直接访问数据,代码会变得一团糟,c++的封装,多态,继承,和java基本都差不多,
2017-09-20
前面 那位给老师指错误的 " 慕娘 "大哥不要乱给老师指错误的,这程序我试了,没有问题,我估计你连运行都没运行过吧?先给cpu赋值再比较?然后再赋值?你不累呀你
2017-09-19