Question: Exercise 2 Create a file named A1.java remember that the class name should match the file name (i.e. public class A1). Place all your code

Exercise 2 Create a file named A1.java remember that the class name should match the file name (i.e. public class A1). Place all your code in this file. Write a method named sayHello that returns the string Hello World!. Hints: Don't forget static. Remember that you must specify the return type ahead of time, and that Hello World! is a String. Call your method from main and print out the result. Your program should print out: Hello World! Exercise 3 Write a method named sum that takes in 2 double values and returns their sum. Hint: What type is the sum of 2 doubles? Exercise 4 Write a method named divide that takes in 2 int values (a, b) and returns their quotient (a / b). Hint: What type is the quotient of 2 ints
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
