⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 variabletest.java

📁 ssd3的教程 是我们老师给我们的 纯英文 有兴趣的可以
💻 JAVA
字号:
import java.io.*;

class Variable{
	int x=0,y=0,z=0;//类的成员变量
	void init(int x,int y) {
		this.x=x; this.y=y;//方法的参数名与类的成员变量名相同,this区别方法参数和类的成员变量
		this.x=this.x+1;
		int z=5;//局部变量
		System.out.println("** in init**");
		System.out.println("x="+this.x+" y="+this.y+" z="+z);
	} 
}

public class VariableTest{
	public static void main(String[] args){
		Variable v=new Variable();
		System.out.println("**before init**");
		System.out.println("x="+v.x+" y="+v.y+" z="+v.z);
		v.init(20,30);
		System.out.println("**after init**");
		System.out.println("x="+v.x+ " y="+ v.y+" z="+v.z);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -