怎么这么多public class myexample程序写的怎么这么夸张呀.public class example {
  String  st1;
  private int a1;
  
  public example(string st1 ,int a1) {
  this.st1=st1;
  this.a1=a1;
  
  } 
  public void print(){
  system.out.printin(st1+a1);
}public static void main(string[] args){
example hello=new example("hello,world!",999);//**********
hello.print;
}
}

解决方案 »

  1.   

    老兄 啊 你的代码 错的一塌糊涂 啊 惨不忍睹!example.javapublic class example {
      String  st1;
      private int a1;  public example(String st1 ,int a1) {
      this.st1=st1;
      this.a1=a1;  }
      public void print(){
      System.out.println(st1+a1);
    }
    }myexample.javapublic class myexample{
    public static void main(String[] args){
    example hello=new example("hello,world!",999);//**********
    hello.print();
    }
    }
    是正确的
    但是至少有20处不符合java 编码规范!!!!!
      

  2.   

    楼上的:"但是至少有20处不符合java 编码规范!!!!!"哈哈哈,太打击人了吧,留一点自尊好不好
      

  3.   

    看你的程序,知道两个类在同一文件中。因此,有以下问题:
    1.只能有一个类为public而且该类名为文件名,同时是运行的类(一般是有main函数的类);
    2.Java取分大小写,否则出错;
    3.函数与变量的调用不同,函数肯定有()、变量肯定没有();
    4.编码太不规范,这是最要不得的。
      

  4.   

    哈哈,不好意思,刚开始实践.自然错误多多.
    那么在jbuilder6中怎么像visual c++那样运行c的源代码呢?
      

  5.   

    主要的问题是最后一句:hello.print;
    应该这么写:hello.print();
    你可以右击该文件,选择run
    运行后,在消息窗口(Message pane)中能看到结果。