wwss123456
------解决方案--------------------
lianxi t=new lianxi();
lianxi.Dec dec=t.new Dec();
内部类创建错了~
------解决方案--------------------
public class lianxi {
public static void main(String[] args){
double d=1.23;
lianxi b1 = new lianxi();
Dec dec= b1.new Dec();
dec.decrement(d);
System.out.println(d);
}
class Dec{
public Dec(){};
public double decrement(double d){
return d=d-1;
}
}
就没了,输出:
1.23
}
------解决方案--------------------
public class lianxi {
public static void main(String[] args){
double d=1.23;
lianxi b1 = new lianxi();
Dec dec= b1.new Dec();
dec.decrement(d);
System.out.println(d);
}
class Dec{
public Dec(){};
public double decrement(double d){
return d=d-1;
}
}
}
------解决方案--------------------
- Java code
public class lianxi { public static void main(String[] args) { double d = 1.23; lianxi l = new lianxi();//先实例一个lianxi对象 Dec dec = l.new Dec(); dec.decrement(d); System.out.println(d); } class Dec { public Dec() { } public double decrement(double d) { return d = d - 1; } }}