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

📄 simpleclassdemo2.java

📁 JAVA程序设计课程中各章节的程序实例。
💻 JAVA
字号:
/**
*Here is a simple access demonstration program
* to various access attributes

*/

class Access
{
	private int p1;
	public int p2;
	
	void displayPublic()
	{
		System.out.println("The public variable accessed from the class itself: " + p2);
	}

	void displayPrivate()
	{
		System.out.println("The private variable must be accessed from the class itself: " + p1);	
	}

}

public class simpleClassDemo2
{
	public static void main(String args[])
	{
		Access obj = new Access();
		
//		obj.p1 = 1;		//p1 has private access in the Access class
		obj.p2 = 2;
		
		obj.displayPublic();
		obj.displayPrivate();
	}
}

⌨️ 快捷键说明

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