Error while importing BUT no namespace collision

R

Radith

I'm just testing the following code to clear up on namespaces:

import com.radithsilva.simple.*;
import java.util.*;

public class LibTest {
public static void main(String[] args) {
Vector v = new Vector();
List l = new List();
java.util.Vector w = new java.util.Vector();
}

}

com.radithsilva.simple.* contains both the first Vector() and List(). BUT
when I use the Vector() from java.util.* the compiler produces an error.

All help appreciated to solve this problem.

Cheers
 
R

Ryan Stewart

Radith said:
I'm just testing the following code to clear up on namespaces:

import com.radithsilva.simple.*;
import java.util.*;

public class LibTest {
public static void main(String[] args) {
Vector v = new Vector();
List l = new List();
java.util.Vector w = new java.util.Vector();
}

}

com.radithsilva.simple.* contains both the first Vector() and List(). BUT when
I use the Vector() from java.util.* the compiler produces an error.
If you're saying what I think you're saying, you should check your results
again. You should get a "reference to Vector is ambiguous..." twice for the
first line of your main method and the same for List on the second line of your
main method. The third line should compile fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top