| 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)
|
 |
 |
|
|
subject: OCPJP code
|
|
|