从第一章我就已经看不懂了!!!!!!!!!!!什么类什么对象,什么普通调用静态 什么方法,一团雾水!!!啊啊啊啊啊 疯了!!!!!
2017-03-20
static int score1 = 86;
static int score2 = 92;
// 定义静态方法sum,计算成绩总分,并返回总分
public static int sum() {
int sum0=score1+score2;
return sum0;
}
public static void main(String[] args) {
// 调用静态方法sum并接收返回值
int allScore = sum();
System.out.println("总分:" + allScore)
static int score2 = 92;
// 定义静态方法sum,计算成绩总分,并返回总分
public static int sum() {
int sum0=score1+score2;
return sum0;
}
public static void main(String[] args) {
// 调用静态方法sum并接收返回值
int allScore = sum();
System.out.println("总分:" + allScore)
2017-03-19
static String className = "new一个美女解寂寞";
System.out.println( "通过类名访问className:"+HelloWorld.className )
HelloWorld haha=new HelloWorld();System.out.println("通过对象名访问className:"+haha.className);
haha.className="Java助我脱单";
System.out.println("通过类名访问className:"+HelloWorld.className);
}
}
System.out.println( "通过类名访问className:"+HelloWorld.className )
HelloWorld haha=new HelloWorld();System.out.println("通过对象名访问className:"+haha.className);
haha.className="Java助我脱单";
System.out.println("通过类名访问className:"+HelloWorld.className);
}
}
2017-03-19