04-27-2011, 10:45 PM
A.A. Sir! My AddressBookTest Class is giving error "[unchecked] unchecked call to add(E) as a member of the raw type java.util.ArrayList persons.add(p) Please tell me how to get rid of it. Thank you.
|
AddressBookTest Class is giving error in java 2011
|
|
04-27-2011, 10:45 PM
A.A. Sir! My AddressBookTest Class is giving error "[unchecked] unchecked call to add(E) as a member of the raw type java.util.ArrayList persons.add(p) Please tell me how to get rid of it. Thank you.
04-27-2011, 10:46 PM
You are getting this warning because we are not specifying what type of object we will be storing in the array.
Consider the example given below public class ArrayListTest { public static void main(){ /* List l = new ArrayList(); l.add("String"); l.add(55); */ /*This code will generate the warning*/ /* How ever if tell in the start what type of object you will store in list you will no get the warning */ List<Object> l = new ArrayList<Object>(); l.add("String"); l.add(55); */ } } 0300-9520262 Get solution in 24 hour |cpmputer & internet mileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
|
|
« Next Oldest | Next Newest »
|