“Java for-ever loop” Kode Jawaban

Java Foreach

List<String> someList = new ArrayList<String>();
// add "monkey", "donkey", "skeleton key" to someList
for (String item : someList) {
    System.out.println(item);
}
Bright Beaver

Foreach Java

for (String name : names) {
    System.out.println(name);
}
Itchy Ibis

Java for-ever loop

// print array elements 

class Main {
  public static void main(String[] args) {
      
    // create an array
    int[] numbers = {3, 7, 5, -5};
    
    // iterating through the array 
    for (int number: numbers) {
       System.out.println(number);
    }
  }
}
SAMER SAEID

Jawaban yang mirip dengan “Java for-ever loop”

Pertanyaan yang mirip dengan “Java for-ever loop”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya