Sponsored Links


Results 1 to 2 of 2

Thread: AddressBookTest Class is giving error in java 2011

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member saneha's Avatar
    Join Date
    Apr 2011
    Posts
    266

    Icon20 AddressBookTest Class is giving error in java 2011

    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.

    Sponsored Links

  2. #2
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    Posts
    9,578
    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); */

    }

    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 04-16-2013, 09:08 PM
  2. Replies: 0
    Last Post: 03-31-2012, 11:43 PM
  3. Replies: 0
    Last Post: 06-24-2011, 07:50 AM
  4. Replies: 0
    Last Post: 06-24-2011, 07:44 AM
  5. Replies: 0
    Last Post: 06-24-2011, 07:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft