while死循环

版权声明:ByRisonBoy https://blog.csdn.net/Rison_Li/article/details/83153568

1、没有自增自减变量

public static void main(String[] args){
		int x = 0;
	      while( x < 3 ) {
	         System.out.println("value of x : " + x );
	         //i++;
	         continue; 
	      }   
	  }

2、条件永远为true

public static void main(String[] args){
		int x = 0;
	     while(true) {
	         System.out.println("value of x : " + x );    
	      }   
	  }
	

3、do while中没有自增自减变量

public static void main(String[] args){
		  int x = 0;
	      do{
	         System.out.println("value of x : " + x );
	      }while( x < 3 );
	}

4、死代码

public static void main(String[] args){
		while(true){}
	}

猜你喜欢

转载自blog.csdn.net/Rison_Li/article/details/83153568