Berikut codingnya :
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Latihan;
/**
*
* @author Mirra
*/
public class ArrayHilang {
public static void main(String[] args) {
int [] ages = new int[35];
for(int i=0; i<ages.length; i++){
ages[i] = i;
if(ages[i] == 7){
continue;}
if(ages[i] == 10){
continue;
}
if(ages[i] == 20){
continue;
}
if(ages[i] == 30){
continue;
}
System.out.println(i);
}
}
}
Hasil compilenya :
run:
0
1
2
3
4
5
6
8
9
11
12
13
14
15
16
17
18
19
21
22
23
24
25
26
27
28
29
31
32
33
34
BUILD SUCCESSFUL (total time: 2 seconds)
No comments:
Post a Comment