Menu
Question Index
...

What will be the output of the following program?

class BajajBike
{
    void BajajBike() // LINE M
    {
        System.out.println("This is Bajaj Bike.");
    }
    
    public static void main(String[] args)
    {
        new BajajBike();
    }
}


This is Bajaj Bike.
Compilation Error
The program executes but there is no output.
An exception is thrown at LINE M

Doubts

Problems

Topic: Create Objects Using Constructors In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App