📄 mainapp.java~1~
字号:
package usethis;/** * <p>Title: 主类函数</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class MainApp { /** 整型变量x*/ private int x; /** 整型变量y*/ private int y; /** * 构造函数 * 为x, y赋值,并分别调用methodOne和methodTwo方法 */ public MainApp(){ x = 1; y = 2; methodOne(); methodTwo(x, y); } /** * 将MainApp类当前对象传递给UseThis类的构造函数, * 实例化UseThis类的对象 */ private void methodOne(){ UseThis ut = new UseThis(this); } /** * 将参数x,y传递给UseThis类的构造函数,实例化UseThis类的对象 * @param x int 整型参数x * @param y int 整型参数y */ private void methodTwo(int x, int y){ UseThis ut = new UseThis(x, y); } /** * 输出打印x, y */ public void use(){ System.out.println("x = " + x); System.out.println("y = " + y); } /** * 主函数 * 实例化MainApp类的对象 * @param args String[] */ public static void main(String[] args) { MainApp mainApp = new MainApp(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -