Write the definition of a method twice, which receives an integer parameter and returns an integer that is twice the value of the parameter.
Language: Java
Challenge:
Write the definition of a method twice, which receives an integer parameter and returns an integer that is twice the value of the parameter.
SOLUTION:
Language: Java
Challenge:
Write the definition of a method twice, which receives an integer parameter and returns an integer that is twice the value of the parameter.
Solution:
public int twice (int x){ return 2*x; }