0
点赞
收藏
分享

微信扫一扫

class First { public static class Contents{

骨灰级搬砖工 2023-06-16 阅读 53


public class First {  
	public static class Contents{  
			 public void getStr(){  
			System.out.println("First.str="+str);  
		 }
	 
	}  
	private static String str="hello!";  

	private void sayHi()
	{
		System.out.println("Hi!");
	}
	/
	public  class Contents2{  
			 public void getStr(){  
			System.out.println("First.str="+str2);  
		 }
	 
	}  
	private  String str2="hello2!";  

	private void tryContents2()
	{
		Contents2 obj=new Contents2();
		obj.getStr();
	}
	
	public static void main(String[] args) 
	{
		System.out.println("Hello World!");
		Contents obj=new Contents();
		obj.getStr();
		First  f=new First();
		f.sayHi();
		f.tryContents2();
		
	}	

} 
/*
Hello World!
First.str=hello!
Hi!
First.str=hello2!
请按任意键继续. . .
*/



举报

相关推荐

0 条评论