What will be the output of the following code?

Last Updated :
Discuss
Comments

What will be the output of the following code?

Java
import java.util.*;
public class Test {
    public static void main(String[] args) {
        Set<String> set = new HashSet<>();
        set.add("Java");
        set.add("Python");
        set.add("Java");
        System.out.println(set);
    }
}


[Java, Python, Java]

[Java, Python]

[Python, Java, Java]

Compilation Error

Share your thoughts in the comments