public class PrintAllJavaChar{
static char character = 1;
static PrintThread[] threadArray = null;
public static void main(String args[]){
for(int i=20;i>0;i --){
threadArray[i-1] = new PrintThread("thread" + i);
}
}
public static synchronized void increase_char(){
do{
System.out.println(
character ++
+ " 's Unicode is "
+(int) character);
if(character == 65535){
for(PrintThread thread:threadArray){
thread.stop();
}
}
}while(character < 65536);
}
}
class PrintThread extends Thread{
private String threadName;
public PrintThread(String threadName){
super(threadName);
this.threadName = threadName;
start();
}
public void run(){
try{
PrintAllJavaChar.increase_char();
}catch(Exception e){
System.out.println(e + "错误");
}
}
}
static char character = 1;
static PrintThread[] threadArray = null;
public static void main(String args[]){
for(int i=20;i>0;i --){
threadArray[i-1] = new PrintThread("thread" + i);
}
}
public static synchronized void increase_char(){
do{
System.out.println(
character ++
+ " 's Unicode is "
+(int) character);
if(character == 65535){
for(PrintThread thread:threadArray){
thread.stop();
}
}
}while(character < 65536);
}
}
class PrintThread extends Thread{
private String threadName;
public PrintThread(String threadName){
super(threadName);
this.threadName = threadName;
start();
}
public void run(){
try{
PrintAllJavaChar.increase_char();
}catch(Exception e){
System.out.println(e + "错误");
}
}
}