Click here to Skip to main content
15,904,934 members
Home / Discussions / Java
   

Java

 
Questionpeersim simulator message passing Pin
parisa6819-Sep-13 6:41
parisa6819-Sep-13 6:41 
AnswerRe: peersim simulator message passing Pin
Richard MacCutchan19-Sep-13 21:20
mveRichard MacCutchan19-Sep-13 21:20 
GeneralRe: peersim simulator message passing Pin
parisa6819-Sep-13 21:44
parisa6819-Sep-13 21:44 
GeneralRe: peersim simulator message passing Pin
Richard MacCutchan19-Sep-13 22:03
mveRichard MacCutchan19-Sep-13 22:03 
QuestionPhp Pin
Member 1028500119-Sep-13 5:25
Member 1028500119-Sep-13 5:25 
AnswerRe: Php Pin
Richard MacCutchan19-Sep-13 21:03
mveRichard MacCutchan19-Sep-13 21:03 
AnswerRe: Php Pin
Usama Moud27-Sep-13 8:26
Usama Moud27-Sep-13 8:26 
Questionproblem with inheritance Pin
Asaf Shay18-Sep-13 1:59
Asaf Shay18-Sep-13 1:59 
Java
package exam804;
class Base
{
	public static void foo(Base bObj)
	{
		System.out.println("In Base.foo()");
		bObj.bar();
	}

	public void bar()
	{
		System.out.println("In Base.bar()");
	}
}

class Derived extends Base
{
	public static void foo(Base bObj)
	{
		System.out.println("In Derived.foo()");
		bObj.bar();
	}

	public void bar()
	{
		System.out.println("In Derived.bar()");
	}
}

class OverrideTest
{
	public static void main(String[] args)
	{
		Base bObj = new Derived();
		bObj.foo(bObj);
	}
}

why the output is
"In Base.foo() In Derived.bar()" and not
"In Derived.foo() In Derived.bar()" ?
QuestionRe: problem with inheritance Pin
Richard MacCutchan18-Sep-13 2:51
mveRichard MacCutchan18-Sep-13 2:51 
AnswerRe: problem with inheritance Pin
Asaf Shay19-Sep-13 9:17
Asaf Shay19-Sep-13 9:17 
GeneralRe: problem with inheritance Pin
jschell19-Sep-13 11:26
jschell19-Sep-13 11:26 
AnswerRe: problem with inheritance Pin
linaast18-Sep-13 20:38
linaast18-Sep-13 20:38 
GeneralRe: problem with inheritance Pin
Asaf Shay19-Sep-13 9:24
Asaf Shay19-Sep-13 9:24 
AnswerRe: problem with inheritance Pin
Mr_z22-Sep-13 10:36
Mr_z22-Sep-13 10:36 
AnswerRe: problem with inheritance Pin
Usama Moud27-Sep-13 9:36
Usama Moud27-Sep-13 9:36 
AnswerRe: problem with inheritance Pin
angrybobcat29-Sep-13 9:57
angrybobcat29-Sep-13 9:57 
AnswerRe: problem with inheritance Pin
Vivek Vermani13-Jan-14 12:04
Vivek Vermani13-Jan-14 12:04 
QuestionPlease Help with a Java code Pin
Adewagold16-Sep-13 22:01
Adewagold16-Sep-13 22:01 
AnswerRe: Please Help with a Java code Pin
Richard MacCutchan17-Sep-13 0:33
mveRichard MacCutchan17-Sep-13 0:33 
AnswerRe: Please Help with a Java code Pin
Member 1028017517-Sep-13 7:04
Member 1028017517-Sep-13 7:04 
QuestionJSpinner Value into Database? Pin
chdboy15-Sep-13 19:46
chdboy15-Sep-13 19:46 
AnswerRe: JSpinner Value into Database? Pin
Richard MacCutchan15-Sep-13 21:20
mveRichard MacCutchan15-Sep-13 21:20 
GeneralRe: JSpinner Value into Database? Pin
chdboy15-Sep-13 21:31
chdboy15-Sep-13 21:31 
GeneralRe: JSpinner Value into Database? Pin
Richard MacCutchan15-Sep-13 21:43
mveRichard MacCutchan15-Sep-13 21:43 
GeneralRe: JSpinner Value into Database? Pin
chdboy17-Sep-13 3:46
chdboy17-Sep-13 3:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.