1.2.1 一个简单的应用程序
public class Hello{
public static void main(String args[]){
System.out.println("你好,很高兴学习 Java");
A a=new A();
a.fA();
}
}
class A{
void fA(){
System.out.println("We are students");
}
}
1.2.2 源文件的命名规则
public class People{
int height;
void speak(){
System.out.printf("我身高是:%d",height);
}
}
class A{
public static void main(String args[]){
People zhubajie;
zhubajie=new People();
zhubajie.height=170;
System.out.println("zhubajie.height");
System.out.println("主类不一定是public类");
zhubajie.speak();
}
}