“Für jede Java” Code-Antworten

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

Für jede Schleife Java


public class Sample {
    public static void main(String[] args) {
        String names[] = { "Jasmine", "Lyka", "Marbie", "Soleen", "Tiny" };
        for (String name : names) {
            System.out.println(name);
        }
    }
}
Fernandez, Jasmine M.

Java foreach

for (String item : someList) {
    System.out.println(item);
}
Alina Samatova

Für jede Java

int value;
int[] arr = {6, 7, 8};

for (value : arr) {
	System.out.print(val + " ");
}
Jittery Jay

Für jede Java

class For_Each    
{
    public static void main(String[] arg)
    {
        {
            int[] marks = { 125, 132, 95, 116, 110 };
             
            int highest_marks = maximum(marks);
            System.out.println("The highest score is " + highest_marks);
        }
    }
    public static int maximum(int[] numbers)
    {
        int maxSoFar = numbers[0];
         
        // for each loop
        for (int num : numbers)
        {
            if (num > maxSoFar)
            {
                maxSoFar = num;
            }
        }
    return maxSoFar;
    }
}
Said HR

Ähnliche Antworten wie “Für jede Java”

Fragen ähnlich wie “Für jede Java”

Weitere verwandte Antworten zu “Für jede Java” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen