Write a Java program to draw pattern 2

Write a Java program to draw a pattern like mentioned below:

Java Program- Pattern 2

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();
		}
 
	}
}

Author: Mahesh

Technical Lead with 10 plus years of experience in developing web applications using Java/J2EE and web technologies. Strong in design and integration problem solving skills. Ability to learn, unlearn and relearn with strong written and verbal communications.