I already posted this question but I gave it a try I'm not sure if I'm on the right track:

Make a util class with three methods. First method's name is add, that returns the result by adding two numbers.

Second method's name is multiply, that returns the result by multiplying two numbers.

Third's method name is division that returns a result by dividing first parameter by second parameter. How would I do this part?

This is what I've got so far:

public class Util {


public static int add(int a, int b){

int result = a + b;
System.out.println("result = " + result);

return result;
}
public static void main(String[] args) {

int res = add(5, 2);

System.out.println("res = " + res);
}

public static int multiply(int a, int b){

int result = a * b;
System.out.println("result = " + result);

return result;
}
public static void main(String[] args) {
int res = multiply(5, 2);

System.out.println("res = " + res);
}
}

looks pretty good so far. But your best help is your IDE, or the javac error messages. If there are no compile errors, then just run your code and see what it produces. It looks like you are getting a handle on things. Just keep poking around to find code snippets that do what you want, and then adapt them to your application.

Hi Steve, I'm having trouble with this part: Third's method name is division that returns a result by dividing first parameter by second parameter. How would I do this part?

odd - you know how to do multiplication.

Do a division in the same way. Just copy the multiply routine, and replace * with /.

Be sure to watch out for division by zero.

You are on the right track with creating a util class with three methods. However, there are a few modifications you need to make to your code.

First, you are currently adding the result of the add method within the add method itself. Instead, you should just return the result without printing it.

Second, you are creating two main methods within the same class, which is not allowed. You should only have one main method in your program. You can combine all the method calls in a single main method.

Here's an updated version of your code:

```java
public class Util {
public static int add(int a, int b) {
int result = a + b;
return result;
}

public static int multiply(int a, int b) {
int result = a * b;
return result;
}

public static double divide(int a, int b) {
double result = (double) a / b;
return result;
}

public static void main(String[] args) {
int num1 = 5;
int num2 = 2;

int sum = add(num1, num2);
System.out.println("Sum: " + sum);

int product = multiply(num1, num2);
System.out.println("Product: " + product);

double division = divide(num1, num2);
System.out.println("Division: " + division);
}
}
```

In this code, I added the third method `divide`, which performs division on the first parameter divided by the second parameter. Note that I changed the return type to `double` to handle cases where the division may result in a decimal value.

In the main method, I created two variables `num1` and `num2` to hold the values you want to perform operations on. Then, I called each method with the appropriate arguments and stored the result in a variable. Finally, I printed out the results for each operation.

Hope this helps! Let me know if you have any further questions.