Code Snippets in JAVA Programming and their OUTPUTS-Day 3
CODE SNIPPETS OUTPUT
METHOD OVERRIDING AND DYNAMIC BINDING
Concept: Method overriding
class General
{
void show()
{
System.
out.
println("show in General");
}
}
class Test extends General
{
void...
More
Code Snippets in JAVA Programming and their OUTPUTS-Day 3
CODE SNIPPETS OUTPUT
METHOD OVERRIDING AND DYNAMIC BINDING
Concept: Method overriding
class General
{
void show()
{
System.
out.
println("show in General");
}
}
class Test extends General
{
void show()
{
System.
out.
println("show in Test");
}
public static void main (String [] args)
{
Test t=new Test();
t.
show();
}
}
show in Test
class OldGeneral
{
void show()
{
System.
out.
println("show in Old General");
}
}
show in Test
Less