Path sum in binary tree
If recursion has reached a leaf node then either you have accumulated
the correct sum or not, but in no case it is necessary to check the
left or right child node. Therefore I would change the first
implementation slightly to

public static boolean hasPathSum1 (Node root, int sum) { 
      if (root == null) {                               
          return false;
      }
      if (root.left == null &amp;&amp; root.right == null) {
          return root.data == sum;  
      }     
      return hasPathSum1(root.left, sum - root.data) ||
             hasPathSum1(root.right, sum - root.data);
}   


If the values of all nodes are non-negative then you can 
stop the search if the accumulated sum along a path is greater than the target sum:

public static boolean hasPathSum1 (Node root, int sum) { 
      if (sum &lt; 0) {                               
          return false;
      }
      if (root == null) {                               
          return false;
      }
      if (root.left == null &amp;&amp; root.right == null) {
          return root.data == sum;  
      }     
      return hasPathSum1(root.left, sum - root.data) ||
             hasPathSum1(root.right, sum - root.data);
}   


(and similarly for the iterative versions).

Some advice from the answers to your previous question DFS in Binary Tree
applies here as well:


Better/consistent spacing: if and while is sometimes followed
by a space (good) and sometime not (bad).
Rename the root parameter to node.
Make those methods instance methods of the Node class instead of
static methods.