例题

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

总结:

这是今天打得代码。室友一起打得,我发现她们在 System.out.println("tui:"+cat.leg+"tiao");
  System.out.println("tou:"+cat.head);
  cat.cry("fight with Jerry");这两段代码商贩的错误比较多,在我打的时候就特意注意了一下,其实就是输入法和符号的问题,于是我就一直用英文的输入法。果然一次通过,没有报错。以后也要经常注意小问题

posted @ 2013-03-14 22:28  崔琪同学  阅读(127)  评论(0编辑  收藏  举报