黑马程序员技术交流社区

标题: 找错挑错;大家来找茬(学习&方法) [打印本页]

作者: 曹思敏    时间: 2013-5-30 18:14
标题: 找错挑错;大家来找茬(学习&方法)
本帖最后由 曹思敏 于 2013-6-1 08:58 编辑

public class People

int height;
String ear;
void speak(String s)
{
System.out.println(s);
}
}
class A
public static void main(String[] args)
{
People coco;
coco=new People();
coco.height=175;
coco.ear="Two ears";
  System.out.println("height:"+coco.height);
  System.out.println(coco.ear);
  coco.speak("Master,shall we go to east");
}   
}
作者: 画饼    时间: 2013-5-30 18:48
A类少括号了,哥哥还有你的public 怎么不在A类。
作者: 刘胜寒    时间: 2013-5-31 00:38
楼主是来混技术分的吧{:soso_e113:}
作者: Sword    时间: 2013-6-1 00:02
楼主,这种问题只限给加一次技术分,希望多注意,谢谢合作
作者: 山鹰    时间: 2013-6-1 00:16
class A后面少{ ,代码没有问题  
作者: HM张博文    时间: 2013-6-1 04:32
这种问题只限给加一次技术分,希望多注意,谢谢合作
作者: 王瀛    时间: 2013-6-1 07:51
  1. class People
  2. {
  3.         int height;
  4.         String ear;
  5.         void speak(String s)
  6.         {
  7.                 System.out.println(s);
  8.         }
  9. }
  10. class AB
  11. {//<------------------------------------------------------少个括号
  12.         public static void main(String[] args)
  13.         {
  14.                 People coco;
  15.                 coco=new People();
  16.                 coco.height=175;
  17.                 coco.ear="Two ears";
  18.                 System.out.println("height:"+coco.height);
  19.                 System.out.println(coco.ear);
  20.                 coco.speak("Master,shall we go to east");
  21.         }   
  22. }
复制代码





欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2