Null pointer Exception how?

static void levelOrder(Node node)
{

  if(node == null){
      return ;
  }
  
  Queue<Node> q = new LinkedList<>();
  
  q.add(node);
  
  while(!q.isEmpty()){
      
      Node temp = q.peek();
      
      if(temp.left!= null){
          q.add(node.left);
          
      }
      
      if(temp.right!=null){
          q.add(node.right);
      }
      
      System.out.print(temp.data);
      
      q.remove();
      
  }

}

@amankumar7017 Bro don’t send just a snippet, paste your whole code in codingblocks ide
https://ide.codingblocks.com/ here and save it then paste the link here. Then only I will be able to check your whole code right!