Ask a New Question

Question

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.
10 years ago

Answers

Steve
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.
10 years ago

Related Questions

Is there a method in Java in which to see if an integer value contains characters? Write a java method that will take two sorted stacks A and B (min on top), and return one stack D t... how do i write java program using for loop that decreases by 1 and when it reaches 0, it increases t... I need to write a code in java based on an alrgorithm, the alrgorithm and it’s problem are below: T... how to write this in java? 55555*55555 4444***4444 333*****333 22*******22 1*********1 3. Write a java program to • Read and store 10 numbers in an Arr ay. • Display the sum mat ion of... Write java application of The users should only be able to add tasks to the application if they hav... Write a Java application to display the price difference between two types of camera technologies,... Write program in java without using public static void travelToFuture Objective: To build a time-tr... What would you write for a JavaScript code to disable securly classroom on a school computer, hypoth...
Ask a New Question
Archives Contact Us Privacy Policy Terms of Use