Thread: compiling error

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    9
    Rep Power
    0
    "Ambiguous class: java.awt.List and java.util.List
    private List ll;
    "

    The above error appear when i compile the java applet. I am not certain for the error and would like to know what the error is and how to correct this. Thanks!!

    Comments on this post

    • JimmyGosling agrees
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    Colorado
    Posts
    46
    Rep Power
    14
    This just means that you have inported both java.awt.List and java.util.List and the compiler does not know which one you are trying to use when you specify "private List ..."

    You are probably importing java.awt.* and java.util.* so you are getting both List classes from the two different packages. There are two ways of fixing this:

    One, import only the classes you need instead of the whole package. EG - import java.util.List; instead of import java.util.*;

    Two, specify the entire package name when you declare your List object. If you are really trying to use java.util.List and NOT java.awt.List try: "private java.util.List ..." instead of "private List ..."

    Hope that helps.
    - MW

IMN logo majestic logo threadwatch logo seochat tools logo