Berikut adalah source code untuk mencari variable count pada java dengan menggunakan netbeans.
source code :
public static void main(String[] args) {
String names [] = {"Beah", "Bianca","Lance",
"Beach"}; int count = 0;
for (int i=0; i<names.length; i++) {
if ( !names [i].equals ("beah") ) {
continue;
}
count++;
}
}
}
output:
source code :
public static void main(String[] args) {
String names [] = {"Beah", "Bianca","Lance",
"Beach"}; int count = 0;
for (int i=0; i<names.length; i++) {
if ( !names [i].equals ("beah") ) {
continue;
}
count++;
}
}
}
output:
Komentar
Posting Komentar