A method is defined that takes a name and hours slept as parameters and returns a string combining them. The main method declares variables for a name and hours, calls the returnHours method passing the variables, stores the returned value, and prints it.
Role Of Transgenic Animal In Target Validation-1.pptx
aWrite a method named returnHours with two parameters a st.pdf
1. a)Write a method named returnHours with two parameters: a string representing your name
and the number of hours you spend sleeping.
Make the string by appending your name and the number of hours you spend sleeping.
Return this string.
b)In the main method:
Declare and initialize your name and hours you sleep in the main method.
Call returnHourse, passing your name and hours you sleep as arguments.
c)The value returned by the method will be stored in a variable in main.
d)Print the variable containing the returned value in main.
Start with:
public class PassingReturnMethod {
public static void main(String[] args) {