Question: using basic java please Task 4: Pad String Write a method called padString that accepts two parameters: a string and an integer representing a length.
using basic java please

Task 4: Pad String Write a method called padString that accepts two parameters: a string and an integer representing a length. The method should pad the parameter string with spaces of the given length. For example padString("hello", 8) should print" hello". Since hello is only 5 characters we need to pad it with 3 spaces to get it to be 8 in length. If the strings length is already as long as the parameter, your method should print he original string. For example, padStrins("congratulations", 15) should print "congratulations"; there is no padding because there are 15 letters in congratulations Complete the program by having the main method that call padString) with the values from the above and prints the results to the console
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
