Menu
Question Index
...

What will be the output of the following program?

public class FindIt {
    public static void displayNames(String... names) {
        System.out.println(names.length);
        for (String word : names) {
            System.out.print(word + " ");
        }
    }
    public static void main(String args[]) {
        displayNames("Kiran", "and", "Ashok", "are", "friends.");
    }
}


5
Kiran and Ashok are friends.
3
Kiran and Ashok
Some other output
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java String Arrays - String Arrays 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