Simple Continue Statement in Java

Simple Continue Statement in Java

Java program code with continue statement
Continue Statement in java is used to continue execution of a particular program code segment. If  used inside an inner loop, the code in the loop is executed:

Continue Statement Flow Diagram

Simple Continue Statement in Java

Example Code




 public class ContinueStatement {  
   public static void main(String args[])  
   {  
   int[] marks={20,25,30,70,80,90};  
    for(int x : marks) {  
      if( x == 30 ) {  
       continue;  
      }  
      System.out.print( x );  
      System.out.print("\n");  
    }  
   }  
 }  

Output:


 run:  
 20  
 25  
 70  
 80  
 90  
 BUILD SUCCESSFUL (total time: 0 seconds)  

Continue Statement with inner loop

Inner loop code is executed if continue statement is used inside the inner loop.

Example Code:



 public class JavaContinueStatement {  
   public static void main(String[] args) {   
       for(int i=1;i<=5;i++){    
           for(int j=1;j<=5;j++){    
             if(i==3&&j==3){    
               continue;    
             }    
             System.out.println(i+" "+j);    
           }    
       }    
 }   
 }   

Output:


 run:  
 1 1  
 1 2  
 1 3  
 1 4  
 1 5  
 2 1  
 2 2  
 2 3  
 2 4  
 2 5  
 3 1  
 3 2  
 3 4  
 3 5  
 4 1  
 4 2  
 4 3  
 4 4  
 4 5  
 5 1  
 5 2  
 5 3  
 5 4  
 5 5  
 BUILD SUCCESSFUL (total time: 0 seconds)  

COMMENTS

Name

android android Apps android emulators antivirus blogger bluestack Break Statement in Java constructors download downloader drivers emulators java java control statements java do-while loop java for loop java infinitive do-while loop java system methods java tutorials Java While Loop java.awt java.swing javalookandfeel javascript JButton JCheckBox JColorChooser JComboBox JDialog JFileChooser JFrame JLayeredPane JList JMenuBar joomla JOptionPane JPanel JPasswordField JPopupMenu JProgressBar JRadioButton JScrollBar JSlider JSpinner JTabbedPane JTable JTextArea JTextField JToolBar mysql php plugins Polymorphism setToolTiptext skype for windows software swing class themes Visual Studio Code WeChat whatsapp wordpress
false
ltr
item
Java Codes: Simple Continue Statement in Java
Simple Continue Statement in Java
Simple Continue Statement in Java
https://2.bp.blogspot.com/-vXdH4O2XgZE/WJHSA10ZY1I/AAAAAAAAGyA/iLRzU8A-Kjo79kCGXNez00dcXk7D_JwagCLcB/s320/Java%2Bcontinue%2Bstatement-min.PNG
https://2.bp.blogspot.com/-vXdH4O2XgZE/WJHSA10ZY1I/AAAAAAAAGyA/iLRzU8A-Kjo79kCGXNez00dcXk7D_JwagCLcB/s72-c/Java%2Bcontinue%2Bstatement-min.PNG
Java Codes
http://www.download-all.net/2017/02/simple-continue-statement-in-java.html
http://www.download-all.net/
http://www.download-all.net/
http://www.download-all.net/2017/02/simple-continue-statement-in-java.html
true
7826648292785071009
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy