issue instantiating object of Java generic class -


I am trying to understand Java generics. I'm having trouble in urging a generic class object. Am I going to go wrong in any insights?

In a document, the general category:

  public class SearchSortAlgorithms & lt; T & gt; Search Sitadat & lt; T & gt; Applies to {ÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, · | Public Zero quickSort (T [] list, full length) {recQuickSort (list, 0, length - 1); } One ?? In another:  
  public class TestQuickSort {public static zero main (string [] args) {// Define an integer 50000 elements Array integer [] array = new integer [5000]; // to load the array with random numbers, // a for loop and Math.random () method - (int) (Math.random (* 50000)) for (int i = 0; i & lt; anArray .length; i ++) {Airere [i] = (int) (Math.Randem) * I); } // Print the first 50 array elemnts with a for loop // for system.out.print (int j = 0; j & lt; = 50; j ++) {System.out.print (anArray [ J] + ""); } System.out.println (); // Define an object of SearchSortAlgorithm with the integer data type // Use this object to call the quickSort method with parameters: your array name and size -5000 search circuit algorithm & lt; Integer & gt; AnotherArray = New Search Servers Algorithm & lt; Integer & gt; (); // This is where I get my error message. Array SCONSOR (AARRA, 5000); // Print the first 50 array elements with one for loop / them now (int k = 0; k & lt; = 50; k ++) {System.out.print (anotherArray [k] + " To be sorted); }}}   

Error message:

  java: 39: array is required, but SearchSortAlgorithms & lt; Java.lang.Integer & gt;    

this syntax

  anotherArray [k] / / ^ ^   

Works with array types only anoterArray has not been declared as an array.

Are you anArray ?

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -