思路:最小公倍数=两数乘积/(最大公因子);
如何求取最大公因子:采用辗转相除法或者采用递归
public static int gb(int A,int B){
if(A==0||B==0){
return 0;
}
return (A*B)/gy(A,B);
}
public static int gy(int A,int B){
if(A==0||B==0){
return 0;
}
if(A<B){
int temp=A;
A=B;
B=temp;
}
int m;
int n;
while((A%B)!=0){
n=B;
B=A%B;
A=n;
}
return B;
}
递归求最大公因子
if(B==0){
return A;
}
return gy(B,A%B);
归纳总结:
最大公因子:又称最大公约数,是指两个或者多个整数具有的最大约数
辗转相除法
最小公倍数:两个或者多个整数共有的倍数,除0以外最小的倍数,为最小公倍数 质因数分解法 公式法
继承存在着传递性
x=102;
用对象的引用是可以访问静态变量的,只是不建议使用
类访问控制关键字:public private protected default
java 使用的字符码集unicode;