GeeCON Prague 2014*
The moose likes Java in General and the fly likes Packages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Packages" Watch "Packages" New topic
Author

Packages

Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 217

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

Joined: Jul 26, 2007
Posts: 10426
    
    8

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

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39084
    
  23
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

Joined: Oct 13, 2005
Posts: 39084
    
  23
Have you been taking lessons from Rob, Maneesh?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

He's been spending quite a long time in the Swing forum with me


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
GeeCON Prague 2014
 
subject: Packages