Finding the maximum sum of any 2 elements in an array of integers
Your code tries all \$ n (n+1)/2 \$ combinations of array elements to find the
combination with the largest sum, so the complexity is \$ O(n^2) \$.

A better solution would be to find the two largest elements in the
array, since adding those obviously gives the largest sum.

Possible approaches are:


Sort the array elements in increasing order and add the last two
elements. Efficient sorting algorithms (such as Quicksort) have an
average complexity of \$ O(n \log(n)) \$.
Traverse the array once and keep track of the largest and second
largest element encountered so far. Then add those elements.
The complexity is \$ O(n) \$.


Other remarks:


Your main program computes maxSum(array) twice,
which is not necessary.
You should check if the user entered at least 2 elements, otherwise
the problem is ill-defined.
The if (!in.hasNextInt()) check is not really helpful. If the user
enters a non-integer, "put an integer! " is printed, but then in.nextInt() fails with an exception. You could for example
skip the entire input line until a valid integer is entered:

while (!in.hasNextInt()) {
    System.out.println("Enter an integer! ");
    in.nextLine();
}
int size = in.nextInt();