📄 gongbeigongyue.java
字号:
/*
* Main.java
*
* Created on 2008年10月30日, 上午12:55
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package test;
import java.util.*;
/**
*
* @author Administrator
*/
class A{
public int a,b;
void get(){
System.out.println("input the a and b:");
Scanner reader =new Scanner(System.in);
a=reader.nextInt();
b=reader.nextInt();
}
int gongyue(){
int m = 1;
int gy;
//如果a小于b则交换位置
if(a<b){
m = a;
a = b;
b = m;
}
while(m != 0){
m = a%b;
a = b;
b = m;
}
gy=a;
System.out.println("the gongyue of a and b is:"+gy);
return a;
}
}
class B{
int gongbei(){
A c=new A();
c.get();
int gb;
gb=c.a*c.b/c.gongyue();
System.out.println("the gongbei of a and b is:"+gb);
return gb;
}
}
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
A gongyue=new A();
gongyue.get();
gongyue.gongyue();
B gongbei=new B();
gongbei.gongbei();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -