📄 scope1.java
字号:
//c3:Scope1.java
//author:ZhangHongbin
//This program is protected by copyright laws.
//Scope of variables.
public class Scope1
{
int i=1;
void func()
{
System.out.println("output i member in class in func="+i);
int i=2;
System.out.println("i in func="+i);
}
public static void main(String[] args)
{
{
int i=3;
System.out.println("i in main="+i);
}
Scope1 s1=new Scope1();
Scope1 s2=new Scope1();
System.out.println("output i member of class in main="+s1.i);
s1.func();
s2.i=4;
System.out.println("output i member of class in main again="+s2.i);
s2.func();
//System.out.println("i in main="+i);//error
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -