Don’t worry, unlock all articles / blogs on PrepInsta by just simply logging in on our website
Type atleast 3 characters
Popular Searches
Trending Pages
Notifications Mark All Read
No New notification
InfyTQ Menu9>
PREPINSTA PRIME
Get Hiring Updates right in your inbox from PrepInsta
Question 1
Public class newclass extends maruti extends car { }
Yes, multiple inheritance is allowed
Yes, but it will generate warnings
It depends on the system running it
No, Java doesn't support multiple inheritance
Start
Question 2
class exam { void myMethod() { System.out.println("prepinstaplacement"); } } public class Derived extends exam { void myMethod() { System.out.println("prepinsta"); } public static void main(String[] args) { Derived obj = new exam(); obj.myMethod(); } }
prepinstaplacement
prepinsta
Compilation error
Runtime error
Question 3
Encapsulation
Interface
Composition
Inheritance
Aggregation
Question 4
object
class
Root
java
Question 5
String str = "prepinsta"; boolean switch = str instanceof String;
true
false
null
Question 6
sub, super
super, super
super, sub
sub, sub
Question 7
Method overloading
Constructor overloading
Method overriding
All the above
Question 8
Make use of the parent class’s capabilities
Over-ride or add the minimum to accomplish the derived class’ purpose
Override all the methods of its parent class
Make sure the result “IS-A-KIND-OF” its base class
Make sure the result “contains” its base class
Question 9
“is a kind of” relationship
“has a” relationship
“want to be” relationship
inheritance does not describe any kind of relationship between classes
“contains” of relationship
Question 10
class prepinsta { protected void getData() { System.out.println("Inside prepinsta"); } } class prepinstaplacement extends prepinsta { protected void getData() { System.out.println("Inside prepinstaplacement"); } } public class exam { public static void main(String[] args) { prepinsta obj = new prepinstaplacement(); obj.getData(); } }
Inside prepinsta
Inside prepinstaplacement
Please login to report