package class02;
public class Telephone {
public void Telephone1(float a1,float b1,float c1) {
float a;
float b;
float c;
a=a1;
b=b1;
c=c1;
System.out.print(a);
System.out.print(b);
System.out.print(c);
}
}
package class02;
import class02.Telephone;
public class PHONE {
public static void main(String[] args) {
// TODO Auto-generated method stub
Telephone1 phone2=new Telephone1(1.0f,2.0f,3.0f);
}
}
同一个包的话就不需要“import class02.Telephone;”了;
把“Telephone1 phone2=new Telephone1(1.0f,2.0f,3.0f);”改成这样:
Telephone phone2=new Telephone();
phone2.Telephone1(1.0f,2.0f,3.0f);