COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following gives an error in case of Java varags?
A
int doIt(int a, int b, double c, int ____ vals) { }
B
int doIt(int ____ vals) {
C
int doIt(int a, int b, double c, int ____ vals, boolean stopFlag) { }
D
None of the above
Explanation: 

Detailed explanation-1: -Explanation: In the above example, the Vararg variable “stu” is of String array type.

Detailed explanation-2: -Varargs also known as variable arguments is a method in java that takes input as a variable number of arguments. It is used for simplifying a method that requires a variable number of arguments. In java, we can’t declare a method with a variable number of arguments until JDK 4.

There is 1 question to complete.