beandemo.java

来自「java模式设计」· Java 代码 · 共 35 行

JAVA
35
字号
//限定属性演示示例程序;

public class BeanDemo
{
	public static void main(String[] args)
	{
		IndexBean ib=new IndexBean();
	
		try{
			IndexBeanListener ibl=new IndexBeanListener();
			ib.addVetoableChangeListener(ibl);
//						
//			System.out.println("BEAN中的属性初始值为:");
//			ib.printProperty();
//			ib.setstr("ss",1);
//			System.out.println("第4个值是: "+ib.getstr(3));
//			ib.setstr("tmd",0);						
//			System.out.println("BEAN中的属性修改后的值为:");
//			ib.printProperty();
			
			
			String[] str={"h1","h2","h3","tmd","h4"};
			ib.setstr(str);
			System.out.println("设置字符串数组后BEAN中的属性值为:");
			ib.printProperty();
			
		}
		catch(Exception e)
		{
			e.printStackTrace();
			System.out.println("发生异常后BEAN中的属性值为:");
			ib.printProperty();
		}	
	}	
}

⌨️ 快捷键说明

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