wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes JLS 4.3.4, When Reference Types Are the Same Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "JLS 4.3.4, When Reference Types Are the Same" Watch "JLS 4.3.4, When Reference Types Are the Same" New topic
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JLS 4.3.4, When Reference Types Are the Same
 
Similar Threads
Interface
Lifecycle callbacks, transaction and security contexts
short casting question
WA #1.....word association
i'm bit curious about the concatenated string literals with +