Menu
Question Index
...

What will be the output of the following program?

public class Final
{
    public static void main(String[] args)
    {
        final String result = "MERIT";
        final String assign;
        
        Final f = new Final();
        assign = "CAMPUS";

        final String xchange = " ";
        
        System.out.println(process(result, assign, xchange));
    }

    static String process(String a, String b, String xchange)
    {
        xchange = b + " " + a;

        return xchange;
    }
}


MERIT CAMPUS
CAMPUS MERIT
Compilation Error because the final variable xchange is initialised twice
Compilation Error for some other reason
Runtime Error

Doubts

Problems

Topic: final Keyword 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