public class work1 {
static int level = 15;
//类变量 属于work1 随类消失
String name = "花木兰";
//实例变量 从属于对象
public static void main(String[] args) {
int i=0;
//局部变量 类的方法中的变量
}
}
public class work2 {
static double i;
public static void main(String[] args) {
System.out.println(i);
}
}
3.
public class work3 {
static final int damage=300;
public static void main(String[] args) {
System.out.println(damage);
}
}
public class work4 {
public static void main(String[] args) {
int i=1;
int j=1;
int result;
while(i<=9){
j=1;
while(j<=i){
result=i*j;
System.out.print(j+"*"+i+"="+result+"\t");
j++;
}
i++;
System.out.println("");
}
}
public class work4 {
public static void main(String[] args) {
for(int i=1;i<=9;i++){
for(int j=1;j<=i;j++){
System.out.print(j+"*"+i+"="+i*j+"\t");
}
System.out.println();
}
}
}
public class work5 {
public static void main(String[] args) {
int age=18;
double height=1.72;
double weight=55.0;
double BMI;
BMI = 0.1*weight/(height*height);
System.out.println(age);
System.out.println(BMI);
System.out.println(age==18);
System.out.println(age<15);
System.out.println(age!=20);
int score=90;
int hege=60;
String level=score>hege?"达标":"不达标";
System.out.println(level);
}
}