“Arrays -Methoden in Java” Code-Antworten

Arrays -Methoden in Java

int[] intArray = { 1, 2, 3, 4, 5 };
ArrayUtils.reverse(intArray);
System.out.println(Arrays.toString(intArray));
//[5, 4, 3, 2, 1]
Hilarious Horse

Arrays -Methoden in Java

// Java program to demonstrate
// Arrays.compareUnsigned() method
 
import java.util.Arrays;
 
public class Main {
    public static void main(String[] args)
    {
 
        // Get the Arrays
        int intArr[] = { 10, 20, 15, 22, 35 };
 
        // Get the second Arra
        int intArr1[] = { 10, 15, 22 };
 
        // To compare both arrays
        System.out.println("Integer Arrays on comparison:
                           + Arrays.compareUnsigned(intArr, intArr1));
    }
}
Aniket Mane

Arrays -Methoden in Java

Set<String> set = new HashSet<String>(Arrays.asList(stringArray));
System.out.println(set);
//[d, e, b, c, a]
Utkarsh Rastogi

Arrays -Methoden in Java

int[] intArray = { 1, 2, 3, 4, 5 };
int[] removed = ArrayUtils.removeElement(intArray, 3);//create a new array
System.out.println(Arrays.toString(removed));
Utkarsh Rastogi

Arrays -Methoden in Java

String[] stringArray = { "a", "b", "c", "d", "e" };
ArrayList<String> arrayList = new ArrayList<String>(Arrays.asList(stringArray));
String[] stringArr = new String[arrayList.size()];
arrayList.toArray(stringArr);
for (String s : stringArr)
	System.out.println(s);
Utkarsh Rastogi

Zwei Array -Strukturen in Java

String[] MONTHS = {
    "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", 
    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
...
System.out.println(MONTHS[m]);
Wide-eyed Wombat

Ähnliche Antworten wie “Arrays -Methoden in Java”

Fragen ähnlich wie “Arrays -Methoden in Java”

Weitere verwandte Antworten zu “Arrays -Methoden in Java” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen