Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- //this is a repitition statement
- //
- public class RepititionStatements {
- public static void main(String [] args) {
- //this is a break example
- int [] numbers = {10,20,30,40,50};
- for (int x : numbers) {
- if (x ==30)
- {
- break; //the control comes out the loop
- }
- System.out.print(x);
- System.out.print("\n");
- }
- }
- }
- --copy until here--
- OUTPUT :
- 10
- 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement