import java.io.*;
                ^这儿缺一个分号

解决方案 »

  1.   

    你用jb一类的作阿
    这样会提示错误的阿
    Math math1=new Math(),math2=new Math(),math3=new Math(),math4=new Math();
    出错了吧
    仔细看看
    嘿嘿
      

  2.   

    你是用什么编辑器写源程序?除了上述两处,还有其它的语法错误。如果你用IDE,例如jbuilder、eclipse等,可以避免语法错误。
      

  3.   

    我在import java.io.*加了分号,出错的提示如下--------------------Configuration: j2sdk1.4.2 <Default>--------------------
    D:\下载\程序\liyan.java:16: class Out is public, should be declared in a file named Out.java
    public class Out{
           ^
    D:\下载\程序\liyan.java:38: class Maths is public, should be declared in a file named Maths.java
    public class Maths{
           ^
    D:\下载\程序\liyan.java:7: Math() has private access in java.lang.Math
    Math math1=new Math(),math2=new Math(),math3=new Math(),math4=new Math();
                       ^
    D:\下载\程序\liyan.java:7: Math() has private access in java.lang.Math
    Math math1=new Math(),math2=new Math(),math3=new Math(),math4=new Math();
                                        ^
    D:\下载\程序\liyan.java:7: Math() has private access in java.lang.Math
    Math math1=new Math(),math2=new Math(),math3=new Math(),math4=new Math();
                                                         ^
    D:\下载\程序\liyan.java:7: Math() has private access in java.lang.Math
    Math math1=new Math(),math2=new Math(),math3=new Math(),math4=new Math();
                                                                          ^
    D:\下载\程序\liyan.java:9: cannot resolve symbol
    symbol  : method plus (int,int)
    location: class java.lang.Math
    mat1.getout(a,'+',b,math1.plus(a,b));
                                     ^
    D:\下载\程序\liyan.java:10: cannot resolve symbol
    symbol  : method minus (int,int)
    location: class java.lang.Math
    mat2.getout(a,'-',b,math2.minus(a,b));
                                     ^
    D:\下载\程序\liyan.java:11: cannot resolve symbol
    symbol  : method multi (int,int)
    location: class java.lang.Math
    mat3.getout(a,'*',b,math3.multi(a,b));
                                     ^
    D:\下载\程序\liyan.java:12: cannot resolve symbol
    symbol  : method div (int,int)
    location: class java.lang.Math
    mat4.getout(a,'/',b,math4.div(a,b));
                                     ^
    D:\下载\程序\liyan.java:34: cannot resolve symbol
    symbol  : method println (int,int,int,java.lang.String)
    location: class java.io.PrintStream
    System.out.println(+a,+c,+b,"="+d);
                              ^
    D:\下载\程序\liyan.java:57: possible loss of precision
    found   : float
    required: int
         return((float)a/b);
                           ^
    12 errorsProcess completed.
    我用的是JCredtor LE 编译的,可是为什么在Math math1=new Math(),math2=new Math(),math3=new Math(),math4=new Math();
    处会出错了?
      

  4.   

    错误多多
    1.import java.io.*少了一个分好
    2.Math math1=new Math(),math2=new Math(),math3=new Math(),math4=new Math();
    按照你的意思,应该是Maths吧
    3.mat1.getout(a,'+',b,math1.plus(a,b));按照你的定义应该只有3个参数,你却给了4个,并且类型不匹配
    4.System.out.println(a,c,b,"="+d);是不是应该写为System.out.println(a+c+b"="+d);
    5.public int div(int a,int b){
    return((float)a/b);
    }
    div返回的是int,而你return的是float
      

  5.   

    如果你这几个class是在一个文件里,那么注意了,只能有一个类是public的,且这个public的类名必须和文件名相同(大小写一致),所以你出来liyan 类是public外,其他的public都删掉
      

  6.   

    一个java文件里 怎么可以有三个public class呀 晕~~
      

  7.   

    我改动如下:import java.io.*;
    public class liyan 
    {
    public static void main(String[] args)
    {
    int a=130,b=45;
    Maths math1=new Maths();
    Maths math2=new Maths();
    Maths math3=new Maths();
    Maths math4=new Maths();
    Out mat1=new Out();
    Out mat2=new Out();
    Out mat3=new Out();
    Out mat4=new Out();
    mat1.getout(a,'+',b,math1.plus(a,b));
    mat2.getout(a,'-',b,math2.minus(a,b));
    mat3.getout(a,'*',b,math3.multi(a,b));
    mat4.getout(a,'/',b,math4.div(a,b));
    }
    } class Out{
    private int a;
    private int b;
    private int d;
    private char c;
    public int getouta(){
    return a;
    }
    public int getoutb(){
    return b;

    public int getoutd(){
    return d;
    }
    public char getoutc(){
    return c;
    }
    public void getout(int a,char c,int b,int d){
    System.out.println(+a,+c,+b,"="+d);
    }
    } class Maths{
    private int a;
    private int b;
    public int geta(){
    return a;
       }
    public int getb(){
        return b;
           }
        public int plus(int a,int b){
         return(a+b);
        }
        public int minus(int a,int b){
         return(a-b);
        }
        public int multi(int a,int b){
         return(a*b);
        }
        public int div(int a,int b){
         return((float)a/b);
        }
    }其出错提示是
    --------------------Configuration: j2sdk1.4.2 <Default>--------------------
    D:\下载\程序\liyan.java:40: cannot resolve symbol
    symbol  : method println (int,int,int,java.lang.String)
    location: class java.io.PrintStream
    System.out.println(+a,+c,+b,"="+d);
                              ^
    D:\下载\程序\liyan.java:63: possible loss of precision
    found   : float
    required: int
         return((float)a/b);
                           ^
    2 errorsProcess completed.这句话要怎么改?
      

  8.   

    1。public float div(int a,int b){
         return((float)a/b);
        }
    2。 public void getout(int a,char c,int b,int d){
    System.out.println(""+a+c+b+"="+d);
    }
      

  9.   

    楼主:一般而言,一个java对应一个class!且文件名与类名对应。如:class abc放在abc.java中!
    还有,你不要用可能是关健字并类库的名称做为类名,以免造成不必要的错误!
    最后把类放在包中!也就是在开头加:package语句!并放在对应的目录下!如,你的src为你的源代码的目录,那么package a.b.c;public class abc;那么你的abc.java就放在src/a/b/c/abc.java中!
      

  10.   

    public class Liyan 
    {
    public static void main(String[] args)
    {
    int a=130,b=45;
    Maths math1=new Maths(),math2=new Maths(),math3=new Maths(),math4=new Maths();
    Out mat1=new Out(),mat2=new Out(),mat3=new Out(),mat4=new Out();
    mat1.getout(a,b,(char)math1.plus(a,b));
    mat2.getout(a,b,(char)math2.minus(a,b));
    mat3.getout(a,b,(char)math3.multi(a,b));
    mat4.getout(a,b,(char)math4.div(a,b));
    }
    }
    class Out{
    private int a;
    private int b;
    public int d;
    private char c;
    public int getouta(){
    return a;
    }
    public int getoutb(){
    return b;

    public int getoutd(){
    return d;
    }
    public char getoutc(){
    return c;
    }
    public void getout(int a,int b,char c){
    System.out.println("d="+(a+b+(int)c));
    }
    }
    class Maths{
    private int a;
    private int b;
    public int geta(){
    return a;
       }
    public int getb(){
        return b;
           }
        public int plus(int a,int b){
         return(a+b);
        }
        public int minus(int a,int b){
         return(a-b);
        }
        public int multi(int a,int b){
         return(a*b);
        }
        public int div(int a,int b){
         return(a/b);
        }
    }
    楼主的Math math1=new Math(),math2=new Math(),math3=new Math(),math4=new Math();都少写了一个s,调用函数getout(a,'+',b,math1.plus(a,b))括号中的参数要和你自己定义的参数一致,还有一些小的错误,自己在好好看看吧。
      

  11.   

    问题解决了,最后的程序如下import java.io.*;
    public class liyan 
    {
    public static void main(String[] args)
    {
    int a=130,b=45;
    Maths math1=new Maths();
    Maths math2=new Maths();
    Maths math3=new Maths();
    Maths math4=new Maths();
    Out mat1=new Out();
    Out mat2=new Out();
    Out mat3=new Out();
    Out mat4=new Out();
    mat1.getout(a,'+',b,math1.plus(a,b));
    mat2.getout(a,'-',b,math2.minus(a,b));
    mat3.getout(a,'*',b,math3.multi(a,b));
    mat4.getout(a,'/',b,math4.div(a,b));
    }
    } class Out{
    private int a;
    private int b;
    private int d;
    private char c;
    public int getouta(){
    return a;
    }
    public int getoutb(){
    return b;

    public float getoutd(){
    return d;
    }
    public char getoutc(){
    return c;
    }
    public void getout(int a,char c,int b,float d){
    System.out.println(""+a+c+b+"="+d);
    }
    } class Maths{
    private int a;
    private int b;
    public int geta(){
    return a;
       }
    public int getb(){
        return b;
           }
        public int plus(int a,int b){
         return(a+b);
        }
        public int minus(int a,int b){
         return(a-b);
        }
        public int multi(int a,int b){
         return(a*b);
        }
        public float div(int a,int b){
         return((float)a/b);
        }
    }为什么Maths math1=new Maths(),math2=new Maths(),math3=new Maths;在JCredtor LE 下不能这样写了?
      

  12.   

    是我复制是出错了
    Maths math1=new Maths(),math2=new Maths(),math3=new Maths();
    我试了可以JCredtor LE 这样写