Distinguish between a default constructor and a parameterised constructor, and state what a copy constructor does.
Constructors
Original Khojo Papers practice question — not from a past board paper.
A constructor has the same name as the class while a method may have any name. A constructor has no return type while a method must declare one. A constructor is invoked automatically when the object is created, whereas a method must be called explicitly.
No citable source has been recorded for this record. Treat it as practice material, not as fact.
A constructor cannot be inherited, though it can be invoked from a subclass constructor with super().
From the same topic and chapter, at a similar level.
Distinguish between a default constructor and a parameterised constructor, and state what a copy constructor does.
Constructors
What is constructor overloading? Give one situation in which it is useful.
Constructors
Write a class Rectangle with a parameterised constructor and a method to return its area.
Constructors
What is a constructor? State three of its characteristics.
Constructors
Explain the ternary operator in Java and rewrite "if (a > b) max = a; else max = b;" using it.
Operators and Expressions in Java
What is the output of: String s = "Examination"; System.out.println(s.length() + " " + s.substring(0, 4) + " " + s.toUpperCase().charAt(2));
String Handling