SlideShare a Scribd company logo
CREATING TWO-DIMENSIONAL
ARRAYS
Chapter 7.4:
Processing 2-Dimensional Array
๏‚ž eg.
โ€ข Initialization
โ€ข Print
โ€ข Input data/store data into 2-Dimensional array
โ€ข Sum the data
โ€ข Find the largest element
๏‚ž Suppose the declaration as below:
int row;
int column;
int matix = new int[7][6];
Initialization
for (row = 0; row < matrix.length; row++)
for (col = 0; col < matrix[row].length; col++)
matrix[row][col] = 10;
matrix
Print
for (row = 0; row < matrix.lenth; row++)
{
for ( col = 0; col < matrix[row].length; col++)
System.out.println(matrix[row][col]);
System.out.println();
}
for (row = 0; row < matrix.length; row++)
for (col = 0; col < matrix[row].length; col++)
matrix[row][col] = Integer.parseInt(keyboard.readLine())
Read Data
Largest Element in Each
Row
for (row = 0; row < matrix.length; row++)
{
largest = matrix[row][0];
for (col = 1; col < matrix[row].length; col++)
if (largest < matrix[row][col])
largest = matrix[row][col];
System.out.println(โ€œThe largest element of rowโ€ + (row+1)
+ โ€œ=โ€œ + largest);
}
Multidimensional Arrays
๏‚ž Can define three-dimensional arrays or n-
dimensional arrays (n can be any number).
๏‚ž Syntax to declare and instantiate array:
dataType[][]โ€ฆ[] arrayName = new
dataType[intExp1][intExp2]โ€ฆ[intExpn];
๏‚ž Syntax to access component:
arrayName[indexExp1][indexExp2]โ€ฆ[indexExpn]
๏‚— intExp1, intExp2, ..., intExpn = positive integers
๏‚— indexExp1,indexExp2, ..., indexExpn = non-negative
integers
Loops to Process Multidimensional
Arrays
double[][][] carDealers = new double[10][5][7];
for (i = 0; i < 10; i++)
for (j = 0; j < 5; j++)
for (k = 0; k < 7; k++)
carDealers[i][j][k] = 10.00;

More Related Content

What's hot

Numpy python cheat_sheet
Numpy python cheat_sheetNumpy python cheat_sheet
Numpy python cheat_sheet
Nishant Upadhyay
ย 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : Arrays
Gagan Deep
ย 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
Anand Ingle
ย 
Arrays
ArraysArrays
Arrays
Chirag vasava
ย 
Learn Java Part 8
Learn Java Part 8Learn Java Part 8
Learn Java Part 8
Gurpreet singh
ย 
Data Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysData Structure Midterm Lesson Arrays
Data Structure Midterm Lesson Arrays
Maulen Bale
ย 
Array in c language
Array in c languageArray in c language
Array in c language
umesh patil
ย 
Learn Java Part 9
Learn Java Part 9Learn Java Part 9
Learn Java Part 9
Gurpreet singh
ย 
Javascript - Getting Good with Loop and Array
Javascript - Getting Good with Loop and ArrayJavascript - Getting Good with Loop and Array
Javascript - Getting Good with Loop and Array
Firdaus Adib
ย 
Pandas Cheat Sheet
Pandas Cheat SheetPandas Cheat Sheet
Pandas Cheat Sheet
ACASH1011
ย 
Array in c language
Array in c languageArray in c language
Array in c language
home
ย 
Arrays Class presentation
Arrays Class presentationArrays Class presentation
Arrays Class presentation
Neveen Reda
ย 
Array in c
Array in cArray in c
Array in c
AnIsh Kumar
ย 
Array BPK 2
Array BPK 2Array BPK 2
Array BPK 2
Riki Afriansyah
ย 
Javascript - Array - Creating Array
Javascript - Array - Creating ArrayJavascript - Array - Creating Array
Javascript - Array - Creating Array
Samuel Santos
ย 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
HNDE Labuduwa Galle
ย 
Lecture 4
Lecture 4Lecture 4
Lecture 4
Skillspire LLC
ย 
Heapsort using Heap
Heapsort using HeapHeapsort using Heap
Heapsort using Heap
Mohamed Fawzy
ย 
Arrays
ArraysArrays
array
array array

What's hot (20)

Numpy python cheat_sheet
Numpy python cheat_sheetNumpy python cheat_sheet
Numpy python cheat_sheet
ย 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : Arrays
ย 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
ย 
Arrays
ArraysArrays
Arrays
ย 
Learn Java Part 8
Learn Java Part 8Learn Java Part 8
Learn Java Part 8
ย 
Data Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysData Structure Midterm Lesson Arrays
Data Structure Midterm Lesson Arrays
ย 
Array in c language
Array in c languageArray in c language
Array in c language
ย 
Learn Java Part 9
Learn Java Part 9Learn Java Part 9
Learn Java Part 9
ย 
Javascript - Getting Good with Loop and Array
Javascript - Getting Good with Loop and ArrayJavascript - Getting Good with Loop and Array
Javascript - Getting Good with Loop and Array
ย 
Pandas Cheat Sheet
Pandas Cheat SheetPandas Cheat Sheet
Pandas Cheat Sheet
ย 
Array in c language
Array in c languageArray in c language
Array in c language
ย 
Arrays Class presentation
Arrays Class presentationArrays Class presentation
Arrays Class presentation
ย 
Array in c
Array in cArray in c
Array in c
ย 
Array BPK 2
Array BPK 2Array BPK 2
Array BPK 2
ย 
Javascript - Array - Creating Array
Javascript - Array - Creating ArrayJavascript - Array - Creating Array
Javascript - Array - Creating Array
ย 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
ย 
Lecture 4
Lecture 4Lecture 4
Lecture 4
ย 
Heapsort using Heap
Heapsort using HeapHeapsort using Heap
Heapsort using Heap
ย 
Arrays
ArraysArrays
Arrays
ย 
array
array array
array
ย 

Viewers also liked

Data Structure Basics
Data Structure BasicsData Structure Basics
Data Structure Basics
Shakila Mahjabin
ย 
Chapter 3.1
Chapter 3.1Chapter 3.1
Chapter 3.1
sotlsoc
ย 
Basics in algorithms and data structure
Basics in algorithms and data structure Basics in algorithms and data structure
Basics in algorithms and data structure
Eman magdy
ย 
Webpage Visual Design and Online Prototype
Webpage Visual Design and Online PrototypeWebpage Visual Design and Online Prototype
Webpage Visual Design and Online Prototype
amoore155
ย 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2
deathful
ย 
Chap 2(const var-datatype)
Chap 2(const var-datatype)Chap 2(const var-datatype)
2. electric field calculation
2. electric field calculation2. electric field calculation
Digital Logic
Digital LogicDigital Logic
Digital Logic
Dilum Bandara
ย 
Problem Solving with Algorithms and Data Structure - Lists
Problem Solving with Algorithms and Data Structure - ListsProblem Solving with Algorithms and Data Structure - Lists
Problem Solving with Algorithms and Data Structure - Lists
Yi-Lung Tsai
ย 
Problem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - GraphsProblem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - Graphs
Yi-Lung Tsai
ย 
Komunikasyon
KomunikasyonKomunikasyon
Komunikasyon
deathful
ย 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
Transweb Global Inc
ย 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
ย 
แž˜แŸแžšแŸ€แž“แŸˆ Data Structure and Algorithm in C/C++
แž˜แŸแžšแŸ€แž“แŸˆ Data Structure and Algorithm in C/C++แž˜แŸแžšแŸ€แž“แŸˆ Data Structure and Algorithm in C/C++
แž˜แŸแžšแŸ€แž“แŸˆ Data Structure and Algorithm in C/C++
Ngeam Soly
ย 
Program logic formulation
Program logic formulationProgram logic formulation
Program logic formulation
Sara Corpuz
ย 

Viewers also liked (15)

Data Structure Basics
Data Structure BasicsData Structure Basics
Data Structure Basics
ย 
Chapter 3.1
Chapter 3.1Chapter 3.1
Chapter 3.1
ย 
Basics in algorithms and data structure
Basics in algorithms and data structure Basics in algorithms and data structure
Basics in algorithms and data structure
ย 
Webpage Visual Design and Online Prototype
Webpage Visual Design and Online PrototypeWebpage Visual Design and Online Prototype
Webpage Visual Design and Online Prototype
ย 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2
ย 
Chap 2(const var-datatype)
Chap 2(const var-datatype)Chap 2(const var-datatype)
Chap 2(const var-datatype)
ย 
2. electric field calculation
2. electric field calculation2. electric field calculation
2. electric field calculation
ย 
Digital Logic
Digital LogicDigital Logic
Digital Logic
ย 
Problem Solving with Algorithms and Data Structure - Lists
Problem Solving with Algorithms and Data Structure - ListsProblem Solving with Algorithms and Data Structure - Lists
Problem Solving with Algorithms and Data Structure - Lists
ย 
Problem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - GraphsProblem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - Graphs
ย 
Komunikasyon
KomunikasyonKomunikasyon
Komunikasyon
ย 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
ย 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
ย 
แž˜แŸแžšแŸ€แž“แŸˆ Data Structure and Algorithm in C/C++
แž˜แŸแžšแŸ€แž“แŸˆ Data Structure and Algorithm in C/C++แž˜แŸแžšแŸ€แž“แŸˆ Data Structure and Algorithm in C/C++
แž˜แŸแžšแŸ€แž“แŸˆ Data Structure and Algorithm in C/C++
ย 
Program logic formulation
Program logic formulationProgram logic formulation
Program logic formulation
ย 

Similar to Chapter 7.4

Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arrays
Aseelhalees
ย 
Chapter 7.1
Chapter 7.1Chapter 7.1
Chapter 7.1
sotlsoc
ย 
R Programming.pptx
R Programming.pptxR Programming.pptx
R Programming.pptx
kalai75
ย 
A quick introduction to R
A quick introduction to RA quick introduction to R
A quick introduction to R
Angshuman Saha
ย 
Java arrays
Java    arraysJava    arrays
Java arrays
Mohammed Sikander
ย 
C (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptxC (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptx
rohinitalekar1
ย 
Array
ArrayArray
Array
PRN USM
ย 
6 arrays injava
6 arrays injava6 arrays injava
6 arrays injava
irdginfo
ย 
Arrays & Strings.pptx
Arrays & Strings.pptxArrays & Strings.pptx
Arrays & Strings.pptx
AnkurRajSingh2
ย 
2- Dimensional Arrays
2- Dimensional Arrays2- Dimensional Arrays
2- Dimensional Arrays
Education Front
ย 
07 Arrays
07 Arrays07 Arrays
07 Arrays
maznabili
ย 
Lec2
Lec2Lec2
Lec2&3 data structure
Lec2&3 data structureLec2&3 data structure
Lec2&3 data structure
Ibrahim El-Torbany
ย 
Lecture 9.pptx
Lecture 9.pptxLecture 9.pptx
Lecture 9.pptx
MathewJohnSinoCruz
ย 
Lecture 9_Classes.pptx
Lecture 9_Classes.pptxLecture 9_Classes.pptx
Lecture 9_Classes.pptx
NelyJay
ย 
Computer Programming- Lecture 9
Computer Programming- Lecture 9Computer Programming- Lecture 9
Computer Programming- Lecture 9
Dr. Md. Shohel Sayeed
ย 
Advance data structure & algorithm
Advance data structure & algorithmAdvance data structure & algorithm
Advance data structure & algorithm
K Hari Shankar
ย 
R training3
R training3R training3
R training3
Hellen Gakuruh
ย 
Arrays and library functions
Arrays and library functionsArrays and library functions
Arrays and library functions
Swarup Boro
ย 
Chap 6 c++
Chap 6 c++Chap 6 c++
Chap 6 c++
Venkateswarlu Vuggam
ย 

Similar to Chapter 7.4 (20)

Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arrays
ย 
Chapter 7.1
Chapter 7.1Chapter 7.1
Chapter 7.1
ย 
R Programming.pptx
R Programming.pptxR Programming.pptx
R Programming.pptx
ย 
A quick introduction to R
A quick introduction to RA quick introduction to R
A quick introduction to R
ย 
Java arrays
Java    arraysJava    arrays
Java arrays
ย 
C (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptxC (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptx
ย 
Array
ArrayArray
Array
ย 
6 arrays injava
6 arrays injava6 arrays injava
6 arrays injava
ย 
Arrays & Strings.pptx
Arrays & Strings.pptxArrays & Strings.pptx
Arrays & Strings.pptx
ย 
2- Dimensional Arrays
2- Dimensional Arrays2- Dimensional Arrays
2- Dimensional Arrays
ย 
07 Arrays
07 Arrays07 Arrays
07 Arrays
ย 
Lec2
Lec2Lec2
Lec2
ย 
Lec2&3 data structure
Lec2&3 data structureLec2&3 data structure
Lec2&3 data structure
ย 
Lecture 9.pptx
Lecture 9.pptxLecture 9.pptx
Lecture 9.pptx
ย 
Lecture 9_Classes.pptx
Lecture 9_Classes.pptxLecture 9_Classes.pptx
Lecture 9_Classes.pptx
ย 
Computer Programming- Lecture 9
Computer Programming- Lecture 9Computer Programming- Lecture 9
Computer Programming- Lecture 9
ย 
Advance data structure & algorithm
Advance data structure & algorithmAdvance data structure & algorithm
Advance data structure & algorithm
ย 
R training3
R training3R training3
R training3
ย 
Arrays and library functions
Arrays and library functionsArrays and library functions
Arrays and library functions
ย 
Chap 6 c++
Chap 6 c++Chap 6 c++
Chap 6 c++
ย 

More from sotlsoc

Chapter 2.0 new
Chapter 2.0 newChapter 2.0 new
Chapter 2.0 new
sotlsoc
ย 
Chapter 1.0 new
Chapter 1.0 newChapter 1.0 new
Chapter 1.0 new
sotlsoc
ย 
Chapter 3.0 new
Chapter 3.0 newChapter 3.0 new
Chapter 3.0 new
sotlsoc
ย 
Chapter 6.5 new
Chapter 6.5 newChapter 6.5 new
Chapter 6.5 new
sotlsoc
ย 
Chapter 11.1
Chapter 11.1Chapter 11.1
Chapter 11.1
sotlsoc
ย 
Chapter 10.3
Chapter 10.3Chapter 10.3
Chapter 10.3
sotlsoc
ย 
Chapter 11.4
Chapter 11.4Chapter 11.4
Chapter 11.4
sotlsoc
ย 
Chapter 11.3
Chapter 11.3Chapter 11.3
Chapter 11.3
sotlsoc
ย 
Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
sotlsoc
ย 
Chapter 11.2
Chapter 11.2Chapter 11.2
Chapter 11.2
sotlsoc
ย 
Chapter 11.0
Chapter 11.0Chapter 11.0
Chapter 11.0
sotlsoc
ย 
Chapter 10.2
Chapter 10.2Chapter 10.2
Chapter 10.2
sotlsoc
ย 
Chapter 10.1
Chapter 10.1Chapter 10.1
Chapter 10.1
sotlsoc
ย 
Chapter 8.0
Chapter 8.0Chapter 8.0
Chapter 8.0
sotlsoc
ย 
Chapter 10.0
Chapter 10.0Chapter 10.0
Chapter 10.0
sotlsoc
ย 
Chapter 9.3
Chapter 9.3Chapter 9.3
Chapter 9.3
sotlsoc
ย 
Chapter 9.4
Chapter 9.4Chapter 9.4
Chapter 9.4
sotlsoc
ย 
Chapter 9.1
Chapter 9.1Chapter 9.1
Chapter 9.1
sotlsoc
ย 
Chapter 8.1
Chapter 8.1Chapter 8.1
Chapter 8.1
sotlsoc
ย 
Chapter 9.0
Chapter 9.0Chapter 9.0
Chapter 9.0
sotlsoc
ย 

More from sotlsoc (20)

Chapter 2.0 new
Chapter 2.0 newChapter 2.0 new
Chapter 2.0 new
ย 
Chapter 1.0 new
Chapter 1.0 newChapter 1.0 new
Chapter 1.0 new
ย 
Chapter 3.0 new
Chapter 3.0 newChapter 3.0 new
Chapter 3.0 new
ย 
Chapter 6.5 new
Chapter 6.5 newChapter 6.5 new
Chapter 6.5 new
ย 
Chapter 11.1
Chapter 11.1Chapter 11.1
Chapter 11.1
ย 
Chapter 10.3
Chapter 10.3Chapter 10.3
Chapter 10.3
ย 
Chapter 11.4
Chapter 11.4Chapter 11.4
Chapter 11.4
ย 
Chapter 11.3
Chapter 11.3Chapter 11.3
Chapter 11.3
ย 
Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
ย 
Chapter 11.2
Chapter 11.2Chapter 11.2
Chapter 11.2
ย 
Chapter 11.0
Chapter 11.0Chapter 11.0
Chapter 11.0
ย 
Chapter 10.2
Chapter 10.2Chapter 10.2
Chapter 10.2
ย 
Chapter 10.1
Chapter 10.1Chapter 10.1
Chapter 10.1
ย 
Chapter 8.0
Chapter 8.0Chapter 8.0
Chapter 8.0
ย 
Chapter 10.0
Chapter 10.0Chapter 10.0
Chapter 10.0
ย 
Chapter 9.3
Chapter 9.3Chapter 9.3
Chapter 9.3
ย 
Chapter 9.4
Chapter 9.4Chapter 9.4
Chapter 9.4
ย 
Chapter 9.1
Chapter 9.1Chapter 9.1
Chapter 9.1
ย 
Chapter 8.1
Chapter 8.1Chapter 8.1
Chapter 8.1
ย 
Chapter 9.0
Chapter 9.0Chapter 9.0
Chapter 9.0
ย 

Recently uploaded

Observational Learning
Observational Learning Observational Learning
Observational Learning
sanamushtaq922
ย 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
ย 
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxxSimple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
RandolphRadicy
ย 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
ย 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
ย 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
ย 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
ย 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
Payaamvohra1
ย 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
indexPub
ย 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
lakshayrojroj
ย 
Information and Communication Technology in Education
Information and Communication Technology in EducationInformation and Communication Technology in Education
Information and Communication Technology in Education
MJDuyan
ย 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
Kalna College
ย 
220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology
Kalna College
ย 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
Kalna College
ย 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
ย 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Kalna College
ย 
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
220711130100 udita Chakraborty  Aims and objectives of national policy on inf...220711130100 udita Chakraborty  Aims and objectives of national policy on inf...
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
Kalna College
ย 
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGHKHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
shreyassri1208
ย 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
khabri85
ย 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
ย 

Recently uploaded (20)

Observational Learning
Observational Learning Observational Learning
Observational Learning
ย 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
ย 
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxxSimple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
ย 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
ย 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
ย 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
ย 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
ย 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
ย 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
ย 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
ย 
Information and Communication Technology in Education
Information and Communication Technology in EducationInformation and Communication Technology in Education
Information and Communication Technology in Education
ย 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
ย 
220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology
ย 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
ย 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
ย 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
ย 
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
220711130100 udita Chakraborty  Aims and objectives of national policy on inf...220711130100 udita Chakraborty  Aims and objectives of national policy on inf...
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
ย 
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGHKHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
ย 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
ย 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
ย 

Chapter 7.4

  • 2. Processing 2-Dimensional Array ๏‚ž eg. โ€ข Initialization โ€ข Print โ€ข Input data/store data into 2-Dimensional array โ€ข Sum the data โ€ข Find the largest element ๏‚ž Suppose the declaration as below: int row; int column; int matix = new int[7][6];
  • 3. Initialization for (row = 0; row < matrix.length; row++) for (col = 0; col < matrix[row].length; col++) matrix[row][col] = 10; matrix
  • 4. Print for (row = 0; row < matrix.lenth; row++) { for ( col = 0; col < matrix[row].length; col++) System.out.println(matrix[row][col]); System.out.println(); } for (row = 0; row < matrix.length; row++) for (col = 0; col < matrix[row].length; col++) matrix[row][col] = Integer.parseInt(keyboard.readLine()) Read Data
  • 5. Largest Element in Each Row for (row = 0; row < matrix.length; row++) { largest = matrix[row][0]; for (col = 1; col < matrix[row].length; col++) if (largest < matrix[row][col]) largest = matrix[row][col]; System.out.println(โ€œThe largest element of rowโ€ + (row+1) + โ€œ=โ€œ + largest); }
  • 6. Multidimensional Arrays ๏‚ž Can define three-dimensional arrays or n- dimensional arrays (n can be any number). ๏‚ž Syntax to declare and instantiate array: dataType[][]โ€ฆ[] arrayName = new dataType[intExp1][intExp2]โ€ฆ[intExpn]; ๏‚ž Syntax to access component: arrayName[indexExp1][indexExp2]โ€ฆ[indexExpn] ๏‚— intExp1, intExp2, ..., intExpn = positive integers ๏‚— indexExp1,indexExp2, ..., indexExpn = non-negative integers
  • 7. Loops to Process Multidimensional Arrays double[][][] carDealers = new double[10][5][7]; for (i = 0; i < 10; i++) for (j = 0; j < 5; j++) for (k = 0; k < 7; k++) carDealers[i][j][k] = 10.00;