ComeçarComece de graça

Squaring

Working part-time 5 hours a day, 5 days a week, you often have to remember the square of 5. Rather than putting it everywhere in our code, let's develop a method to make it easier.

Este exercício faz parte do curso

Intermediate Java

Ver curso

Instruções do exercício

  • Give the proper type to return for the custom method.
  • Call that method, saving the result as hours.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

class Squarer {
  // Give this function the proper return type
  static ____ squareOf5() {
    return 5 * 5;
  }

  public static void main(String[] args) {
    // Call the correct function name defined above
    int hours = ____();
    System.out.println("I'm working " + hours + " hours a week");
  }
}
Editar e executar o código