GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Java/Programs/TwoDArrays.java at main · am-opensource-learner-void/Java

Expand file tree

/

TwoDArrays.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
37 lines (35 loc) · 841 Bytes
/

TwoDArrays.java

Copy path

File metadata and controls

37 lines (35 loc) · 841 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Program to demonstrate 2D arrays (Hard-coded) -
// package TwoDArrays;
class TwoD {
private int i, j;
// Initializing new array of the order 2 X 2
private int arr[][] = new int[10][10];
public void assign() {
System.out.println("Assigning numbers to array: ");
// Assigning numbers to array
int n = 5;
for (i = 0; i <= 3; i++) {
for (j = 0; j <= 3; j++) {
arr[i][j] = n * 2;
n += 5;
}
}
}
public void display() {
// Displaying array
System.out.println("Displaying array: ");
for (i = 1; i <= 3; i++) {
for (j = 1; j <= 3; j++) {
System.out.println("2D Array: " + "["+i+"]" + "["+j+"] : " + arr[i][j]);
}
}
}
}
public class TwoDArrays {
public static void main(String[] args) {
// TODO Auto-generated method stub
TwoD obj = new TwoD();
obj.assign();
obj.display();
}
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.