Error in Generics code example

How we can improve TutorialsPoint.com
no avatar
anand.chaubey
 
Posts: 1
Joined: Thu Mar 22, 2012 11:34 am

Error in Generics code example

by anand.chaubey » Thu Mar 22, 2012 11:45 am

There are few errors in your Java - Generic code example.

Link for the Java Generics is : [b]http://www.tutorialspoint.com/java/java_generics.htm[/b]
Error is as follows :

In the main method you have declared the variables as

Integer[] intArray = { 1, 2, 3, 4, 5 };
Character[] charArray = { 'H', 'E', 'L', 'L', 'O' };

and while accessing you have done like this

System.out.println( "Array integerArray contains:" );
printArray( [b]integerArray [/b]); [b]// pass an Integer array *** This is wrong as no variable with [/b]integerArray

System.out.println( "\nArray characterArray contains:" );
printArray( [b]characterArray [/b]); [b]// pass a Character array *** This is wrong as no variable with characterArrayy[/b]

Please change them to intArray and charArray.

Thanks

Anand Chaubey

no avatar
tutorialspoint
Site Admin
 
Posts: 144
Joined: Fri Apr 27, 2007 6:52 pm

by tutorialspoint » Fri Mar 23, 2012 7:06 am

Thanks dear. This problem has been fixed.

Return to Suggestions

cron