Java game that generates and compares random numbers, looking for matches
Besides minor improvements like consistent formatting and proper indentation I would like to target your random number generation:

int guess1 = 0;
int guess2 = 0;
int guess3 = 0;
int guess4 = 0;

guess1 = rand.nextInt(10);
guess2 = rand.nextInt(10);
guess3 = rand.nextInt(10);
guess4 = rand.nextInt(10);

do {    

    guess1 = rand.nextInt(10);
    guess2 = rand.nextInt(10);
    guess3 = rand.nextInt(10);
    guess4 = rand.nextInt(10); 

if ( guess1 == guess2 || guess1 == guess3 || guess1 == guess4 ) {
    guess1 = rand.nextInt(10);
}
if ( guess2 == guess3 || guess2 == guess4 ) {
    guess2 = rand.nextInt(10);
}
if ( guess3 == guess4 ) {
    guess3 = rand.nextInt(10);
}

} while (guess1 == guess2 || guess2 == guess3 || guess3 == guess4 || guess4 == ball1);


While not incorrect, that certainly looks a bit clumsy.

Since you want four unique random numbers, a better choice would be to create a list of numbers from 0-9, shuffle it and then simply take the first four elements. And while you're at it, convert your four individual variables guess1 to guess4 to a single int[] array of guesses.

This allows you to replace the above code with simply:

List&lt;Integer&gt; numbers = IntStream.range(0, 9).boxed()
        .collect(Collectors.toList());
Collections.shuffle(numbers);
int[] guesses = new int[4];
for (int i = 0; i &lt; 4; i++) {
    guesses[i] = numbers.get(i);
}


(Refactor that into a separate method and you can re-use it for your balls generation as well.)

When guesses and balls are both arrays, the comparison could also be simplified to:

Arrays.equals(guesses, balls);


Arrays.equals:


  Returns true if the two specified arrays of ints are equal to one another. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, two arrays are equal if they contain the same elements in the same order.


(Emphasis by me)