Question: a. Your task is to print a string in a box, like this: [He110! Ilowever, different strings can be substituted for IIcllo A method for

a. Your task is to print a string in a box, like this: [He110! Ilowever, different strings can be substituted for IIcllo A method for this task can be declarcd as follows: public static void boxstring(String contents) Now you develop the body of the method in the usual way, by formulating a general method for solving the task. Print a line that contains the - character n+2 times, where n is the length of the string. Print a line containing the enutents, surrounded with a ! to the left and right. Prist another line containing the - character n+2 times. Note that this method performs some actions and then returns to the caller: Because there is no return value, you cannot use boxstring in an expression. You can call boxstring ("Hel10"); but not result = boxstring ("Hello"); // Error:boxstring doesn't-return a result
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
