Java - Polymorphism



Question 2     

When is method overloading determined?






Question 3     

Method overriding is combination of polymorphism and inheritance





Question 5     

Which type of polymorphism is seen this code?

class Paint {
	public void Color(int x) {
	}

	public void Color(int x, int y) {
	}

	public void Color(int x, int y, int z) {
	}
}





Question 6     

Which type of polymorphism is there in the following code?

class Paint {
	Paint(int x) {
	}

	Paint(int x, int y) {
	}

	Paint(int x, int y, int z) {
	}
}





Question 7     

Which of the following comes under compile time polymorphism?







Question 8     

What is the output of the following code?

class Parent {
	public void show() {
		System.out.println("Parent");
	}
}
class Child extends Parent {
	public void show() {
		System.out.println("Child");
	}
}
public class Sample {
	public static void main(String[] args) {
		Child c = new Child();
		c.show();
	}
}






Question 9     

What is the output of the following code?

class Parent {
	public void show() {
		System.out.println("Parent");
	}
}
class Child extends Parent {
	public void show() {
		System.out.println("Child");
	}
}
public class Main {
	public static void main(String[] args) {
		Child c = new Parent();
		c.show();
	}
}







Sign Up Page

Oops!!

To view the solution need to Login



Score : 0 / 0
L
o
a
d
i
n
g
.
.
.