1/6
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the difference between method overriding and overloading in Java?
Overriding replaces a superclass method in its subclass, while overloading involves writing multiple methods with the same name but different signatures within the same class.
What is the rule for method signatures when overriding in Java?
When overriding a method, the signatures of the superclass and subclass methods must be the same.
What keyword can prevent method overriding in Java?
The final
keyword can prevent method overriding.
What is dynamic binding in Java?
Dynamic binding occurs when Java determines which method to call at runtime, based on the most specific version of the method.
What is polymorphism in Java?
Polymorphism allows methods to handle instances of a superclass and its subclasses, enabling dynamic binding and method overriding.
What is the purpose of the toString()
method in Java?
The toString()
method returns a string representation of an object and is commonly overridden in subclasses to provide meaningful output.
What happens when System.out.println()
is called on an object in Java?
It calls the toString()
method of the object's class, displaying its string representation.