Quick actions

cmd+k|ctrl+k

Navigation

Languages

java-loop5

Snippet info

Language

Java

Visibility

public

Author

w3xue

Created

2023-01-06T07:47:37.591081Z

Updated

2023-01-06T07:47:37.591081Z

public class Test {
   public static void main(String args[]) {
      int [] numbers = {10, 20, 30, 40, 50};
 
      for(int x : numbers ) {
         // x 等于 30 时跳出循环
         if( x == 30 ) {
            break;
         }
         System.out.print( x );
         System.out.print("\n");
      }
   }
}
INFO