Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

What is the output of this code?

0 votes
asked Jan 1, 2019 by Team NSS
import java.util.HashSet;
class A {
   public static void main(String[ ] args) {
   HashSet<String> set = new HashSet<String>();
   set.add("A");
   set.add("B");   
   set.add("C");
   System.out.println(set.size());
   }
}

3 Answers

0 votes
answered Jan 1, 2019 by shitalpatil1212 (140 points)
Output for this program is 3
commented Jan 2, 2019 by fast
nivewowmbnbnbbnnb
0 votes
answered Jan 2, 2019 by vijay
answer is 3 because just size of elements are invoked so size is 3
0 votes
answered Jan 3, 2019 by NikhatShah (180 points)
Output of this program is 3
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...