?? xxx.java
字號:
public class XXX
{
static int tickets=100;
public static void main(String [] args)
{
saleone one=new saleone(tickets);
one.start();
saletwo two=new saletwo(tickets);
two.start();
salethree three=new salethree(tickets);
three.start();
salefour four=new salefour(tickets);
four.start();
}
}
class saleone extends Thread
{
int tickets;
public saleone(int tickets)
{
this.tickets=tickets;
}
public void run()
{
while(true)
{
if(tickets>0&&tickets<=25)
System.out.println("First Window: "+tickets--);
if(tickets==0)
System.exit(0);
}
}
}
class saletwo extends Thread
{
int tickets;
public saletwo(int tickets)
{
this.tickets=tickets;
}
public void run()
{
while(true)
{
if(tickets>26&&tickets<=50)
System.out.println("Second Window: "+tickets--);
}
}
}
class salethree extends Thread
{
int tickets;
public salethree(int tickets)
{
this.tickets=tickets;
}
public void run()
{
while(true)
{
if(tickets>51&&tickets<=75)
System.out.println("Third Window: "+tickets--);
}
}
}
class salefour extends Thread
{
int tickets;
public salefour(int tickets)
{
this.tickets=tickets;
}
public void run()
{
while(true)
{
if(tickets>75&&tickets<=100)
System.out.println("Forth Window: "+tickets--);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -