例题4-5常量的用法/例题4-6通过类名调用类
class Tom{
final int MAX=100;
static final int MIN=20;
}
public class Example4_5{
public static void main(String args[]){
System.out.println(Tom.MIN);
Tom cat=new Tom();
int x=0;
x=Tom.MIN+cat.MAX;
System.out.println(x);
}
}
class Computer{
double x,y;
static double max(double a,double b){
return a>b?a:b;
}
}
class Example4_6{
public static void main(String args[]){
double max=Computer.max(12,45);
System.out.println(max);
}
}