File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes dan new collections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "dan new collections" Watch "dan new collections" New topic
Author

dan new collections

tony kanvas
Ranch Hand

Joined: Oct 26, 2002
Posts: 97

dan said The first method call, m(null,null), calls method m with two null literals that have type null. Both null literals are promoted to type B because B is more specific than type A
but if you see A its same as B why compiler take B
John Paverd
Ranch Hand

Joined: Nov 17, 2002
Posts: 115
Imagine the following class hierarchy:
class Animal {}
class Mammal extends Animal {}
class Horse extends Mammal {}
This makes it a bit easier to see that a sub class is more specific than a super class. Any horse is an animal, but not every animal is a horse.
JLS section 15.12.2.2 has more information about choosing the most specific method:
The informal intuition is that one method declaration is more specific than another if any invocation handled by the first method could be passed on to the other one without a compile-time type error.


SCJP 1.4
Abu Yoosuf
Ranch Hand

Joined: Nov 14, 2002
Posts: 33
Originally posted by tony kanvas:

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: dan new collections
 
Similar Threads
the most specific method is chosen rule (?)
error in dan mock exams chapter6 exam 3 Q no8
ambiguous reference
More specific???
method conversion question