*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes OCPJP code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "OCPJP code" Watch "OCPJP code" New topic
Author

OCPJP code

dhvani shah
Greenhorn

Joined: Oct 23, 2012
Posts: 1
i m preparing for ocpjp. can anyone explain me da flow of this code. and how does the output come mm. its output is mm.

class Thingy{Meter m=new Meter();}
class Component{void go() {System.out.print("c");}}
class Meter extends Component{void go() {System.out.print("m");}}
class Deluxe Thingy extends Thingy{
public static void main(String []args){
Deluxe Thingydt=new Deluxe Thingy();
dt.m.go();
Thingy t= new Deluxe Thingy();
t.m.go();
}
}
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Welcome to CodeRanch dhvani!

Sure, we will help you out. before that Please, QuoteYourSources (<= click here)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OCPJP code