Last active
August 12, 2023 12:23
-
-
Save edores/55db5fb825892d309fc7be96a359c0b7 to your computer and use it in GitHub Desktop.
java.lang.reflect.Array vs java.util.Arrays;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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