This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Abhilash Q#76 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Abhilash Q#76" Watch "Abhilash Q#76" New topic

Abhilash Q#76

Sandeep Potnis
Ranch Hand

Joined: Aug 18, 2000
Posts: 39
Can anyone please explain why option 1 is the right answer here.

1.The code will fail to compile. The class com.abhilash.abhilash can never be imported.
2.The code will compile. Runtime error occurs if one of the class in the import does not exist and is referenced.
3.The code will compile and run with out any problem.

Ranch Hand

Joined: Sep 12, 2000
Posts: 63
I have the same doubt myself. I don't undrstand why he says that the com.abhilash.ahilash can never be imported.
Could someone throw some light on this please.

Joined: Sep 09, 2000
Posts: 21
Hello guys,
you people are overlooking a very basic fact. The package name and Class name cannot be identical. So, the class com.abilash.abhilash can never exist. A non-existant class can never be imported. A compile-time error is thrown.
[This message has been edited by Geek (edited September 16, 2000).]
I agree. Here's the link:
subject: Abhilash Q#76