Table of Contents
Java Constructor Overloading: Definition and Examples
🔒 Please log in to unlock this course.
ONLINE CLASSES BY RUMMAN ANSARI
Stuck on a Java Program? Ask Your Doubt Directly
Book a one-to-one session to get your questions answered, or message on WhatsApp for live online classes in Java Programming.
- 1:1 Mentoring
- Doubt Clearing
- Interview Preparation
Related Questions
Question 1
What is the purpose of default constructor?
Locked. Enroll to open this question.
Question 2
Can a constructor be made final?
Locked. Enroll to open this question.
Question 3
(v) Consider the following Java program and determine its output: class report { int a, b; report()…
Locked. Enroll to open this question.
MCQ Section
MCQ 1
Identify the modifier which cannot be used for constructor.
Locked. Enroll to open this MCQ.
MCQ 2
What will be the output? public class Test{ public static void main(String[] args){ String value =…
Locked. Enroll to open this MCQ.
MCQ 3
What is the output for the below code ? class A{ public A(){ System.out.println("A"); } public…
Locked. Enroll to open this MCQ.
MCQ 4
class A{ A(String s){} A(){} } 1. class B extends A{ 2. B(){} 3. B(String s){ 4. super(s); 5. } 6.…
Locked. Enroll to open this MCQ.
MCQ 5
Determine output of the following program. public class Test{ public static void main(String…
Locked. Enroll to open this MCQ.
MCQ 6
What is the output for the below code? public class Test{ public static void printValue(int i, int…
Locked. Enroll to open this MCQ.
MCQ 7
Determine output: public class Test{ public static void main(String args[]){ MyClass obj = new…
Locked. Enroll to open this MCQ.
MCQ 8
Given the following piece of code: class Person{ public int number; } public class Test{ public…
Locked. Enroll to open this MCQ.
MCQ 9
class MyClass{ MyClass(){ System.out.print("one"); } public void myMethod(){ this();…
Locked. Enroll to open this MCQ.
MCQ 10
Determine Output: class A{ public static void method(int i){ System.out.print("Method 1"); } public…
Locked. Enroll to open this MCQ.
MCQ 11
What is the output of the above program? class Num { Num(double x ){ System.out.println( x ) ; } }…
Locked. Enroll to open this MCQ.
MCQ 12
What is the expected output? public class Profile { private Profile(int w) { // line 1…
Locked. Enroll to open this MCQ.
MCQ 13
which one is correct: class MyClass{ int i; int j; public MyClass(int i, int j){ this.i = i; this.j…
Locked. Enroll to open this MCQ.
MCQ 14
What is the expected output? public class Profile { private Profile(int w) { // line 1…
Locked. Enroll to open this MCQ.
MCQ 15
What will be the result of compiling and running the given code? class A{ int b=10; private A(){…
Locked. Enroll to open this MCQ.
MCQ 16
public class MyClass{ } For the above class(MyClass) what is the correct way of declaring…
Locked. Enroll to open this MCQ.
MCQ 17
The following code contains one compilation error, find it? public class Test { Test() { } // line…
Locked. Enroll to open this MCQ.
MCQ 18
Which of the following options is the best for generating random integer 0 or 1?
Locked. Enroll to open this MCQ.
MCQ 19
The variables declared in a class for the use of all methods of the class are called
Locked. Enroll to open this MCQ.
MCQ 20
What is the output of the following code? public class Test{ public static void main(String…
Locked. Enroll to open this MCQ.
MCQ 21
What is the output of the program? class Test{ public int display(int x, int y){ return ("The sum…
Locked. Enroll to open this MCQ.
MCQ 22
What is the expected output? class Animal { Animal() { System.out.println("Animal"); } } class Wild…
Locked. Enroll to open this MCQ.
MCQ 23
What will be the return type of a method that not returns any value?
Locked. Enroll to open this MCQ.
MCQ 24
Which of these is a legal definition of a method named atnyla assuming it throws IOException, and…
Locked. Enroll to open this MCQ.
MCQ 25
The finalize() method is called just prior to
Locked. Enroll to open this MCQ.
MCQ 26
The main method should be static for the reason
Locked. Enroll to open this MCQ.
MCQ 27
What is Math.floor(3.6)?
Locked. Enroll to open this MCQ.
MCQ 28
In which area of memory, the system stores parameters and local variables whenever a method is…
Locked. Enroll to open this MCQ.
MCQ 29
What is the output for the below code ? 1. public class A{ 2. int add(int i, int j){ 3. return i+j;…
Locked. Enroll to open this MCQ.
MCQ 30
Which of the modifier can't be used for constructors?
Locked. Enroll to open this MCQ.
MCQ 31
Which of the following statements regarding static methods are correct? 1. Static methods are…
Locked. Enroll to open this MCQ.
MCQ 32
What is the prototype of the default constructor? public class Test { }
Locked. Enroll to open this MCQ.
Get Java Programming Language updates by email
Short, practical lessons and course updates from Rumman Ansari. No spam.