Menu
Question Index
...

What will be the output of the following program?

class Demo
{
    public static void main(String[] args)
    {
        Object i = new Object() // LINE A
        {
            public int hashCode()
            {
                int a = 3, b = 5;
                return a * b; // LINE B
            }
        };
        System.out.println(i.hashCode());
    }
}


15
Compile Error at LINE A
Compile Error at LINE B
Runtime Exception

Doubts

Problems

Topic: Advanced Java Programming Concepts

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App