Question
public class Varargs1
{
static void displayStudents(String... stu)
{
for(String s: stu)
System.out.print(s + " ");
}
public static void main(String args[])
{
displayStudents("Bean", "Atkinson", "Milton");
}
}
a.
Bean Bean Bean
b.
null null null
c.
Bean Atkinson Milton
d.
Compiler error
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of the below java program with varargs?
Similar Questions
Discover Related MCQs
Q. A Java Vararg or Variable Argument can come at any position in a method or constructor. State TRUE or FALSE.
View solution
Q. A Java-Vararg can be of any type like primitive or object type. State TRUE or FALSE.
View solution
Q. A Java vararg is a ____.
View solution
Q. A Java-Vararg is nothing but ____.
View solution
Q. Java Varargs are applicable only for ___.
View solution
Q. Which are the methods used to parse string values to the respective data types in Java?
View solution
Q. Any type of data that can be typed on a console or ECLIPSE can be passed as a command-line argument. State TRUE or FALSE.
View solution
Q. Which is the exception or error that is thrown if a non-existing command-line argument is referred to in a Java program?
View solution
Q. Choose the correct way of receiving command-line arguments with in the MAIN method in Java?
View solution
Q. To pass a string as a command-line argument in Java, you need to surround the text within a pair of ___.
View solution
Q. Is there any limit to the number of spaces between two arguments of command-line arguments in Java?
View solution
Q. Can you pass a sentence with multiple words separated by spaces as a single command-line argument in Java?
View solution
Q. The delimiter used to separate command-line arguments in Java is ____.
View solution
Q. The data that is passed at the time of running a Java program as command-line arguments are converted into ___ data type.
View solution
Q. The type of Arguments the MAIN method accepts is ___.
View solution
Q. The command-line arguments in Java are used along with a ____ command.
View solution
Q. Which is the method that accepts data passed in the form of command-line arguments in Java?
View solution
Q. If you need to accept data at runtime, you use ___ in Java.
View solution
Q. When a Java program is executed once, how many times can you pass data using the Command-line arguments?
View solution
Q. The command-line arguments are passes at ____.
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!