What is the output of running class GenericMethodDemo of the

What is the output of running class GenericMethodDemo of the following code?

public class GenericMethodDemo {

public static void main(String[] args ) {

      Integer[] integers = {1, 2, 3, 4, 5};

      String[] strings = {\"London\", \"Paris\", \"Dhaka\",

                            \"Austin\", \"Sydney\"};

      GenericMethodDemo.<Integer>print(integers);

        GenericMethodDemo.<String>print(strings);

     }

   public static <E> void print(E[] list) {

        for (int i = 0; i < list.length; i++){

             System.out.print(list[i] + \" \");

        }

        System.out.println();

     }

}

What is the output of running class GenericMethodDemo of the following code?

public class GenericMethodDemo {

public static void main(String[] args ) {

      Integer[] integers = {1, 2, 3, 4, 5};

      String[] strings = {\"London\", \"Paris\", \"Dhaka\",

                            \"Austin\", \"Sydney\"};

      GenericMethodDemo.<Integer>print(integers);

        GenericMethodDemo.<String>print(strings);

     }

   public static <E> void print(E[] list) {

        for (int i = 0; i < list.length; i++){

             System.out.print(list[i] + \" \");

        }

        System.out.println();

     }

}

Solution

output 1 :

London

Paris

Dhaka

Austin

Sydney

The above is the output of hte above program

What is the output of running class GenericMethodDemo of the following code? public class GenericMethodDemo { public static void main(String[] args ) { Integer[
What is the output of running class GenericMethodDemo of the following code? public class GenericMethodDemo { public static void main(String[] args ) { Integer[

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site