System.out.println("The sum of all even numbers between 2 and the input is " + num);
should be
System.out.println("The sum of all even numbers between 2 and the input is " + sum);
There is a formula to compute the answer without a loop, by the way. But perhaps that is not the point of the exercise?