Skip to content

Instantly share code, notes, and snippets.

@edores
Last active August 12, 2023 12:23
Show Gist options
  • Save edores/55db5fb825892d309fc7be96a359c0b7 to your computer and use it in GitHub Desktop.
Save edores/55db5fb825892d309fc7be96a359c0b7 to your computer and use it in GitHub Desktop.
java.lang.reflect.Array vs java.util.Arrays;
// Array class vs Arrays class
// Importing both classes from resprective packages
import java.lang.reflect.Array;
import java.util.Arrays;
public class A {
public static void main(String[] args)
{
// Getting the size of the array
int[] intArray = new int[5];
// Adding elements into the array
// using setInt() method of Array class
Array.setInt(intArray, 0, 10);
// Printing the Array content
// using util.Arrays class
System.out.println(Arrays.toString(intArray));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment