| Author |
JLS 4.3.4, When Reference Types Are the Same
|
Rupak Khurana
Ranch Hand
Joined: Mar 01, 2005
Posts: 89
|
|
Could someone pls explain the JLS 4.3.4 with an example? That would be very kind of you...
|
SCJP 1.5<br />SCWCD 1.4
|
 |
Devender Thareja
Ranch Hand
Joined: Jul 14, 2005
Posts: 187
|
|
As far as I understand the specs, following are the examples you are looking for. ArraList<String> a, b; StringBuffer c,d; Comparable g, h; MyClass e, f; Here a and b are same compile time type. And so are 3 other pairs: c and d g and h e and f. For same run-time type, I am not 100% confident, but it seems that these variables if point to same objectType then they would be called same run-time type. For example if MySubclass extends MyClass, then: e = new Mysubclass(); f=new Mysubclass(); // same runtime-type e = new MyClass(); f=new MyClass(); // same runtime-type e = new MyClass(); f=new Mysubclass(); // Different runtime-type
|
Devender Thareja
SCEA, SCBCD, SCJP
|
 |
 |
|
|
subject: JLS 4.3.4, When Reference Types Are the Same
|
|
|