Advertisement
Snuggledash

… toString()

May 7th, 2018
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.List;
  3.  
  4. public class ArrayTest {
  5.         public static void main(String[] args) {
  6.                 int[] test1 = {1, 2, 3};
  7.                 List<Integer> test2 = new ArrayList<>(3);
  8.                 test2.add(1);
  9.                 test2.add(2);
  10.                 test2.add(3);
  11.                 Integer[] test3 = new Integer[3];
  12.                 test2.toArray(test3);
  13.                 System.out.print("test1 = ");
  14.                 System.out.println(test1);
  15.                 System.out.print("test2 = ");
  16.                 System.out.println(test2);
  17.                 System.out.print("test3 = ");
  18.                 System.out.println(test3);
  19.         }
  20. }
  21. /* Output:
  22.    test1 = [I@2a139a55
  23.    test2 = [1, 2, 3]
  24.    test3 = [Ljava.lang.Integer;@15db9742
  25.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement