代码改变世界

例题代码2

2013-03-16 12:21  郭莹莹1114010807  阅读(118)  评论(0编辑  收藏  举报

 

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="maotuo";
  System.out.println("tui:"+cat.leg+"tiao");
  System.out.println("tou :"+cat.head);
  cat.cry("I will fight with Jerry");
 }
}