Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Packages

 
Sudhanshu Mishra
Ranch Hand
Posts: 236
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a code snippet:





Why there is no ambiguity while using two classes having same name Vector in the class Test?

Thanks...
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudhanshu Mishra wrote:
Why there is no ambiguity while using two classes having same name Vector in the class Test?


You dont' have two classes called Vector. One is a class, other is a package. Going by naming conventions, it should be package vector and not package Vector
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the compiler interprets the first token after import as a package name. It ought not to have the capital V in that case. You must have a Vector package with a Mosquito class in. The word vector is ambiguous; it has at least three distinct meanings, even though they probably all have the same etymology.
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you been taking lessons from Rob, Maneesh?
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
He's been spending quite a long time in the Swing forum with me
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic