Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
All Other Wrox Books Do you have a question about a Wrox book that isn't listed anywhere on p2p.wrox.com or where the forum is locked? Here's a forum to post questions about any other Wrox book so that other readers or one of the authors can help you with your questions. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the All Other Wrox Books section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 31st, 2005, 04:12 PM
Registered User
 
Join Date: Jan 2005
Location: , , Spain.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning JSP Web Development - Ch08

Hello Everybody!
First, I'm really sorry but my English is not so good.
Well, I have two classes, User.java and ArrayListDemo.java, when I compile the second class (after compile the first class perfectly)I get this warning:

warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.ArrayList
    userlist.add(usr3);
                /

What's the problem? Why can't I add my object usr3?
Can Anyone help me? Thanks!!!

User.java
package com.wrox.utilities;


public class User {

       private String username;
       private String phonenumber;

       public String getUsername() {
              return username;
       }

       public void setUsername(String uname) {
              this.username = uname;
       }

       public String getPhonenumber() {
              return phonenumber;
       }

       public void setPhonenumber(String pnumber) {
              this.phonenumber = pnumber;
       }

       public User(){
       }

       public User(String uname, String pnumber){
              this.username = uname;
              this.phonenumber = pnumber;
       }



}



ArrayListDemo.java
package com.wrox.utilities;
import java.util.ArrayList;

public class ArrayListDemo {
       /* m├ętodo estatico MAIN */

       public static void main(String[] args) {

         User usr1 = new User("J Smith", "123-444-4444");
         User usr2 = new User("M Walker", "123-555-5555");
         User usr3 = new User("R Johnson", "123-666-6666");

         ArrayList userlist = new ArrayList();
         userlist.add(usr3);

         System.out.println("USERS LIST:");

         for (int i=0; i<userlist.size(); i++){
            User usr = (User) userlist.get(i);
            System.out.println("User name: " + usr.getUsername());
            System.out.println("Phone Number: " + usr.getPhonenumber());
         }


       }



}




Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me! about "beginning JSP Web Development" ddgfei JSP Basics 7 May 13th, 2006 12:52 PM
Next levet after "Beginning JSP Web Development" nolas JSP Basics 0 September 29th, 2005 04:58 AM
CHP 17 "BEGINNING JSP WEB DEVELOPMENT" DR POMPEII JSP Basics 2 April 22nd, 2005 11:47 PM
Beginning JSP Web Development Book - Struts questi gstoyanoff JSP Basics 2 February 25th, 2004 02:21 PM
Who have the code of Beginning jsp web development Robertzang JSP Basics 2 September 5th, 2003 03:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.