0% found this document useful (0 votes)
10 views1 page

pr3 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

pr3 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Name:- Deepika Satote

Practical no:- 3.1

public class Grid5x5 {

public static void main(String[] args) {


// Define the size of the grid
final int SIZE = 5;

// Create a 2D array to represent the grid


char[][] grid = new char[SIZE][SIZE];

// Fill the grid with some characters (e.g., 'X')


for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
grid[i][j] = 'X';
}
}

// Display the grid


printGrid(grid);
}

// Method to print the grid


public static void printGrid(char[][] grid) {
for (int i = 0; i < grid.length; i++) {
for (int j = 0; j < grid[i].length; j++) {
System.out.print(grid[i][j] + " ");
}
System.out.println();
}
}
}

You might also like