For this Question: Given an undirected graph of N nodes and E edges. Edges are given in the form of x y if there is an edge between x and y. Print 1 if graph is connected else print 0.Two integers denoting N and E.
Then E lines follow, in each line two integers u, v denoting there is an edge between them.

Constraints 
1<= N <=100000
0<= M <=100000
1<= u, v <=N
Print 1 if graph is connected else print 0.Input :
4 6
1 2
2 3
3 4
4 2
1 3
2 4

Output:
1, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().trim().split(" ");
		int n = Integer.parseInt(line[0]);
		int m = Integer.parseInt(line[1]);
		Set<Integer> set = new HashSet<>();
		while(m-->0){
			String[] str = br.readLine().trim().split(" ");
			set.add(Integer.parseInt(str[0]));
			set.add(Integer.parseInt(str[1]));
		}
		if(set.size()==n){
			System.out.println("1");
		}else{
			System.out.println("0");
		}
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?