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

📄 innertest.java

📁 小型简单的旅馆预订系统. 客户:预定,更改,撤销,会员积分累积,查询预定,会员. 后台:会员更改,房间更改,预定更改,预定信息统计.
💻 JAVA
字号:
package servlet;

interface Selector{
	boolean end();
	Object current();
	void next();
}

public class innerTest
{
	private Object[] items;
	private int next=0;
	public innerTest(int size)
	{
		items=new Object[size];
	}
	public void add(Object x)
	{
		if (next<items.length)
			items[next++]=x;
	}
	private class test implements Selector
	{
		
		private int i=0;
		public boolean end()
		{
			return i==items.length;
		}
		public Object current()
		{
			return items[i];
		}
		public void next()
		{
			if (i<items.length)
				i++;
		}
	}//inner class
	public Selector selector()
	{
		return new test();
	}
	public static void main(String[] args)
	{
		innerTest it=new innerTest(12);
		for (int i=0;i<12;i++)
		{
			it.add(Integer.toString(i));
		}
		Selector selector=it.selector();
		while(!selector.end())
		{
			System.out.print(selector.current()+" ");
			selector.next();
		}
	}
}

⌨️ 快捷键说明

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