Java Void Method and Value Returning Method?

1)

Create a void method. The method name is printWidthAndHeightCalculatuons(int width, int height).

The method takes 2 integers - int width and int height.

The width and height are NOT set to any values.

The method does the same math and has the same sysout statements.

In the main method, you can call printWidthAndHeightCalculations(int width. int height) as many times as you want:

printWidthAndHeightCalculations(5, 15);

printWidthAndHeightCalculations((25, 13);

2)

Make a value returning method call getInputCharFromUser()

This method prompts thebuser for a char. It returns a char.

This method itself does not output the input char. The main method will do this.

Use it in your main method ONLY ONCE.

Like:

char inputChar = getinputCharFromUser();

System.out.println("Character:" + InputChar);

There are no answers yet.
Be the first to answer this question.