SlideShare a Scribd company logo
Chapter six Java
Array
Definition:
Array is known as a set of consecutive memory location which can store
same data type with a common name.
We have two types of array:
One dimensional array
Multi dimensional array
One dimensional array
An array which has one index is known as One dimensional array.
To use an array in a program, you must declare a variable to reference
the array, and you must specify the type of array the variable can
reference. Here is the syntax for declaring an array variable:
dataType[] ArrayName; // preferred way.
or
dataType arrayRefVar[]; // works but not preferred way
Continue..
You can create an array by using the new operator with the following
syntax:
ArrayName = new dataType[arraySize];
The above statement does two things:
It creates an array using new dataType[arraySize];
It assigns the reference of the newly created array to the variable
Two dimensional array
An array which has two indexes is known as two dimensional array, the
steps needed for declaration and creation of two dimensional array is
same like one dimensional array with little difference.
Here is the syntax for declaring array variable:
Data_type[][] array_name// mostly preferred
Or
Data_type array_name[][]// will work but not preferred
Continue..
After declaring an array name then one can create an array with
specific size:
Array_name = new data_type[index1][index2];
Thank You

More Related Content

PPTX
Types of Arrays
DOCX
Array andfunction
PPTX
Data area interaction using rpg
PDF
Java Regular Expression PART I
PPT
Java collections concept
PPT
Variables
PPTX
SQL Prepared Statements Tutorial
PDF
Plsql arrays
Types of Arrays
Array andfunction
Data area interaction using rpg
Java Regular Expression PART I
Java collections concept
Variables
SQL Prepared Statements Tutorial
Plsql arrays

What's hot (18)

PPTX
Collections framework in java
DOCX
Java array
PDF
Java Generics wildcards
PPTX
Versatile Variables
PPTX
ArrayList in JAVA
DOC
Assignment Algo
PPTX
Arrays introduction- JAVA
PPTX
Lec 1.5 Object Oriented Programming
PPTX
Merge sort
PPT
JAVA Collections frame work ppt
PDF
5 collection framework
PDF
Lightning Talk on Metaprogramming in Ruby
DOCX
C# Collection classes
ODP
Java Collections
PPTX
Ml study notes linq
PPTX
Excel Database Function
PDF
10- java language basics part4
PPTX
Quick dive to pandas
Collections framework in java
Java array
Java Generics wildcards
Versatile Variables
ArrayList in JAVA
Assignment Algo
Arrays introduction- JAVA
Lec 1.5 Object Oriented Programming
Merge sort
JAVA Collections frame work ppt
5 collection framework
Lightning Talk on Metaprogramming in Ruby
C# Collection classes
Java Collections
Ml study notes linq
Excel Database Function
10- java language basics part4
Quick dive to pandas
Ad

Similar to Chapter 6 java (20)

PPT
9 cm604.9
PPSX
dizital pods session 6-arrays.ppsx
PPTX
dizital pods session 6-arrays.pptx
PPTX
2 d array
PPTX
Array.pptx
PDF
intorduction to Arrays in java
PPTX
OOPs with java
PPTX
Java Array String
PPTX
Arrays in Data Structure and Algorithm
PPTX
Lecture 7 arrays
DOCX
The Java Learning Kit Chapter 6 – Arrays Copyrigh.docx
PPTX
How to create a two-dimensional array in java
PPTX
Arrays in programming
PPTX
Array in c
PDF
Arrays a detailed explanation and presentation
PPT
Md05 arrays
PDF
Learn Java Part 9
PPTX
ARRAYS.pptx
PPTX
JAVA WORKSHOP(DAY 3) 1234567889999999.pptx
9 cm604.9
dizital pods session 6-arrays.ppsx
dizital pods session 6-arrays.pptx
2 d array
Array.pptx
intorduction to Arrays in java
OOPs with java
Java Array String
Arrays in Data Structure and Algorithm
Lecture 7 arrays
The Java Learning Kit Chapter 6 – Arrays Copyrigh.docx
How to create a two-dimensional array in java
Arrays in programming
Array in c
Arrays a detailed explanation and presentation
Md05 arrays
Learn Java Part 9
ARRAYS.pptx
JAVA WORKSHOP(DAY 3) 1234567889999999.pptx
Ad

More from Ahmad sohail Kakar (20)

PPTX
Lec 1 network types
PPTX
Lec 1 introduction
PPTX
Active directory restoration
PPTX
Active directory backup
PPT
Seii unit7 component-level-design
PPT
Seii unit6 software-testing-techniques
PPT
Seii unit5 ui_design
PPT
Seii unit4 software_process
PPT
Se ii unit3-architectural-design
PPT
Se ii unit2-software_design_principles
PPT
Se ii unit1-se_ii_intorduction
PDF
Second chapter-java
DOCX
Second chapter-java
PPTX
Chapter 9 java
PPTX
Chapter 8 java
PPTX
Chapter 7 java
PPTX
Chapter 5 java
PPTX
Chapter 4 java
PPTX
Chapter 3 java
PPTX
Chapter 2 java
Lec 1 network types
Lec 1 introduction
Active directory restoration
Active directory backup
Seii unit7 component-level-design
Seii unit6 software-testing-techniques
Seii unit5 ui_design
Seii unit4 software_process
Se ii unit3-architectural-design
Se ii unit2-software_design_principles
Se ii unit1-se_ii_intorduction
Second chapter-java
Second chapter-java
Chapter 9 java
Chapter 8 java
Chapter 7 java
Chapter 5 java
Chapter 4 java
Chapter 3 java
Chapter 2 java

Recently uploaded (20)

PDF
Pre independence Education in Inndia.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
RMMM.pdf make it easy to upload and study
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Lesson notes of climatology university.
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Institutional Correction lecture only . . .
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
Pre independence Education in Inndia.pdf
O7-L3 Supply Chain Operations - ICLT Program
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Renaissance Architecture: A Journey from Faith to Humanism
Abdominal Access Techniques with Prof. Dr. R K Mishra
RMMM.pdf make it easy to upload and study
human mycosis Human fungal infections are called human mycosis..pptx
Microbial disease of the cardiovascular and lymphatic systems
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Pharma ospi slides which help in ospi learning
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Lesson notes of climatology university.
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
Microbial diseases, their pathogenesis and prophylaxis
Insiders guide to clinical Medicine.pdf
Institutional Correction lecture only . . .
102 student loan defaulters named and shamed – Is someone you know on the list?
2.FourierTransform-ShortQuestionswithAnswers.pdf

Chapter 6 java

  • 2. Array Definition: Array is known as a set of consecutive memory location which can store same data type with a common name. We have two types of array: One dimensional array Multi dimensional array
  • 3. One dimensional array An array which has one index is known as One dimensional array. To use an array in a program, you must declare a variable to reference the array, and you must specify the type of array the variable can reference. Here is the syntax for declaring an array variable: dataType[] ArrayName; // preferred way. or dataType arrayRefVar[]; // works but not preferred way
  • 4. Continue.. You can create an array by using the new operator with the following syntax: ArrayName = new dataType[arraySize]; The above statement does two things: It creates an array using new dataType[arraySize]; It assigns the reference of the newly created array to the variable
  • 5. Two dimensional array An array which has two indexes is known as two dimensional array, the steps needed for declaration and creation of two dimensional array is same like one dimensional array with little difference. Here is the syntax for declaring array variable: Data_type[][] array_name// mostly preferred Or Data_type array_name[][]// will work but not preferred
  • 6. Continue.. After declaring an array name then one can create an array with specific size: Array_name = new data_type[index1][index2];