Write a method in Java that takes two parameters. If the first parameter is equal to the second parameter multiply both and print the result.

Thanks.

1 answer

There are lots of java snippets online. Here's something that should work:

public static void xx(int n1, int n2) {
if (n1 == n2) System.out.println(n1*n2);
}

It can be prettied up some, but that's basically all you need.
Similar Questions
  1. How would I put this into one program?These are the directions: Write a method that takes two parameters. If the first parameter
    1. answers icon 0 answers
  2. I posted this question before:How would I put this into one program? These are the directions: Write a method that takes two
    1. answers icon 5 answers
    1. answers icon 0 answers
    1. answers icon 1 answer
more similar questions