求大神帮忙,为什么我这里只是把其它类中方法返回值赋值给变量就会执行其它类里的println()方法?
packageexperiement;publicclassMain{publicstaticvoidmain(Stringargs[]){doublef=0;test2...
package experiement;
public class Main {
public static void main(String args[]){
double f=0;
test2Print b=new test2Print();
f=b.test();
}
}
package experiement;
public class test2Print {
public double test(){
double num=26;
System.out.println("bbbb"+num);
return num;
}
} 展开
public class Main {
public static void main(String args[]){
double f=0;
test2Print b=new test2Print();
f=b.test();
}
}
package experiement;
public class test2Print {
public double test(){
double num=26;
System.out.println("bbbb"+num);
return num;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询