构造方法可以不需要调用就可以自己直接输出
public HelloWorld(){
system.out.println("hello")}
public HelloWorld(){
system.out.println("hello")}
2016-04-05
public class HelloWorld {
static int score1 = 86;
static int score2 = 92;
public static int sum() {
return score1 + score2 ;
}
public static void main(String[] args) {
int allScore = sum();
System.out.println("总分:" + allScore);
}
}
static int score1 = 86;
static int score2 = 92;
public static int sum() {
return score1 + score2 ;
}
public static void main(String[] args) {
int allScore = sum();
System.out.println("总分:" + allScore);
}
}
2016-04-04
public static void main(String[] args) {
// 创建对象
HelloWorld hello = new HelloWorld();
// 调用对象的show方法
hello.show();
}
// 创建对象
HelloWorld hello = new HelloWorld();
// 调用对象的show方法
hello.show();
}
2016-04-04
public class HelloWorld {
static int score1 = 86;
static int score2 = 92;
public static int sum() {
int a=score1+score2;
return a;}
public static void main(String[] args) {
int allScore = sum();
System.out.println("总分:" + allScore);
}
}
static int score1 = 86;
static int score2 = 92;
public static int sum() {
int a=score1+score2;
return a;}
public static void main(String[] args) {
int allScore = sum();
System.out.println("总分:" + allScore);
}
}
2016-04-04