420,140 views
39 votes
39 votes
Write a java program as follows Write a method called powOfTwo that takes an integer as parameter, computes, and outputs it’s square

User Bsekula
by
2.9k points

1 Answer

21 votes
21 votes

Answer:

public static int powOfTwo(int input) {

return input*input;

}

You will have to call this method in main
for printing it, write

System.out.println(powOfTwo(your number));

in public static void main(str[]args) {

}

Write a java program as follows Write a method called powOfTwo that takes an integer-example-1
User Kaufman
by
3.2k points