关于找不到MAIN类的问题。。Eclipse 可以运行,UE什么的显示找不到MAIN类 希望大家帮帮忙....
packagezuoye11;publicclassTest12{publicstaticvoidmain(Stringargs[]){gysa1=newgys();Sy...
package zuoye11;
public class Test12 {
public static void main(String args[]) {
gys a1 = new gys();
System.out.print("最大公约数:"+a1.f(252,105));
gbs a2 = new gbs();
System.out.println("最小公倍数:"+a2.f(252,105));
}
}
class gys{
public int f(int a,int b){
int max=Math.max(a,b);
int min =Math.min(a,b);
for(int i=2;i<=max;i++){
int r=max%min;
if(r==0){
break;
}else{
max=min;
min=r;
}
}
return min;
}
}
class gbs extends gys{
public int f(int a,int b){
int m=super.f(a,b);
return a*b/m;
}
} 展开
public class Test12 {
public static void main(String args[]) {
gys a1 = new gys();
System.out.print("最大公约数:"+a1.f(252,105));
gbs a2 = new gbs();
System.out.println("最小公倍数:"+a2.f(252,105));
}
}
class gys{
public int f(int a,int b){
int max=Math.max(a,b);
int min =Math.min(a,b);
for(int i=2;i<=max;i++){
int r=max%min;
if(r==0){
break;
}else{
max=min;
min=r;
}
}
return min;
}
}
class gbs extends gys{
public int f(int a,int b){
int m=super.f(a,b);
return a*b/m;
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询