What is the result of the following code compilation?

class Quest3 {
    public static void main(String s[ ]) {
        String args;
        System.out.print(args + s);
    } 
} 
Explanation
Each variable declared within the method should be initialized before its usage or compiler will report an error otherwise.
Having an initialized args variable within the print() method error will not occur since the addition operator initializes actions of transformation of all the arguments into string
String [] args parameter in main() is just a convention, and any suitable identifier for a string array can be used.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes