“Metode array di java” Kode Jawaban

Metode array di java

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

Metode array di 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

Metode array di java

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

Metode array di 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

Metode array di 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

Dua Struktur Array di Java

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

Jawaban yang mirip dengan “Metode array di java”

Pertanyaan yang mirip dengan “Metode array di java”

Lebih banyak jawaban terkait untuk “Metode array di java” di Java

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya