• Post Reply Bookmark Topic Watch Topic
  • New Topic

Packages

 
Sudhanshu Mishra
Ranch Hand
Posts: 238
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
Bartender
Posts: 11445
18
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
Marshal
Posts: 53171
124
  • 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
Marshal
Posts: 53171
124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you been taking lessons from Rob, Maneesh?
 
Rob Spoor
Sheriff
Posts: 20831
68
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
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!