Here is how I would re-work your program:
public class m {
public static void main (String[] args) {
int nes_sum = 1000; //necessary sum
int last_number = 998; //let's count up to 998
//let's do bruteforce
for(int i = 1; i < last_number; i++) {
for(int o = i+1; o < last_number; o++) {
for(int p = o+1; p < last_number; p++) {
check_everything n = new check_everything(i, o, p); //creating class
if(n.is_sum() && n.is_pythagor()) {
n.post_numbers();
return;
}
}
}
}
}
}
class check_everything //class for checking if it is Pythagoras and sum for 3 numbers {
int need_sum = 1000;
int first_number;
int second_number;
int third_number;
public check_everything(int i, int j, int k) {
setNumbers(i, j, k);
}
private void setNumbers(int a, int b, int c) {
first_number = a;
second_number = b;
third_number = c;
}
public boolean is_pythagor() {
return (first_number * first_number + second_number * second_number == third_number * third_number);
}
public boolean is_sum() {
return (first_number + second_number + third_number == need_sum);
}
public void post_numbers() {
int product = first_number * second_number * third_number;
System.out.println("We have numbers! Product is: "+ first_number +" * "+ second_number +" * "+ third_number +" = "+ product);
}
}
The biggest change is the method's return types. Instead of setting internal variables, it is way better to return a value.
Also, to 'break' all of the way out of the program, just use return.