Write a Java program to draw a pattern like mentioned below:
public class DrawPattern2 { public static void main(String[] args) { int rows = 6; int cols = 6; for (int row = 1; row <= rows; row++) { for (int col = 1; col <= cols; col++) { if(col == 1 || col == row || row==rows){ System.out.print("@"); } else { System.out.print(" "); } } System.out.println(); } } }