例1-1和Jerry拼了
class A{
void f(){
System.out.println("I am A");
}
}
class B{
}
public class Hello{
public static void main(String args[]){
System.out.println("你好,很高兴学习java");
A a=new A();
a.f();
}
}
public class Tom{
int leg;
String head;
void cry(String s){
System.out.println(s);
}
}
class Example{
public static void main(String args[]){
Tom cat;
cat=new Tom();
cat.leg=4;
cat.head="猫头";
System.out.println("腿:"+cat.leg+"条");
System.out.println("头:"+cat.head);
cat.cry("我今天要和Jerry拼了");
}
}