Question: Q4. The Flag class given below has a size field that sets the width and height of a flag. begin{tabular}{l} public class Flag { private



Q4. The Flag class given below has a size field that sets the width and height of a flag. \begin{tabular}{l} public class Flag \{ private int size; . \\ \hline \end{tabular} The driver program is given below: public static void main(String[] args) \{ Flag f= new F lag(); f.printFlag(); f. doublesize(); f.printFlag(); f. doublesize(); f.printFlag() ; \} The output is given below: A. Write a constructor that initializes the size field with the integer value 5 . B. Write a method doublesize that doubles the value of the size field. C. Write a method printFlag that prints the flag with size asterisks () on each side and size asterisks along the right diagonal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
