SlideShare a Scribd company logo
Prepared by-
Shaishav shah(170120116094)
Guided by – Prof. Nisha Patel
Gandhinagar Institute of Technology
SUBJECT - OOPJ (2150704)
Arrays in Java
WHATISARRAY?
Java provides a data structure, the array, which
stores a fixed-size sequential collection of
elements of the same type. An array is used to
store a collection of data, but it is often more
useful to think of an array as a collection of
variables of the same type.
ARRAYS
• DECLARA
TION
• CONSTRUCTION
• INITIALIZATION
• TWODIMENSIONALARRA
Y
• MULTIDIMENSIONALARRA
Y
WHYARRAY?
Problem?
•Implement an application that will calculate 100
students exam average.
•Variables needed?
int studentA; int studentB; int studentC; int studentD;
...
SEVERALVARIABLESATONCE?
Arraycomesto the rescue!
• Justalist of variables
• Declarethe array
int [] array;
• Initialize the array and set it'ssize
array =new array[3];
• Storevaluesinto array
array[0] =2;
array[1] =3;
array[2] =7;
DECLARATION
• Declaring
Arrays:
Int[] mark; Byte[]
age; Double[]
height;
Int mark[]; Byte
age[];
Double height[];
Data type
Array
Name
worksbut not preferredway
preferredway
DECLARATIONCOUNT…
• Array declaration in C++
int hardy[10];
• Array declaration in Java
int [] hardy;
hardy=new int[10];
DECLARATIONCOUNT…
• Storage for the array itself is not allocated
until you use “new”.
• For initializing method the “new” command is
not needed.
int [] hardy={5,3,7,89,2};
CONSTRUCTION
Int [] hardy;
hardy=new int[5];
In single line
Int[] hardy=new
int[5];
Hardyarray
INITIALIZATION
• Initialization isloading the array withthe valies.
Int[] hardy=newint[5]
hardy[0]=32
;
hardy[1]=12
;
hardy[2]=66
;
32 12 66 54 43
0 1 2 3 4
index
TWODIMENSIONALARRAY
• Int[][] hardy=new
int[2][3]; hardy[0][0]=32;
hardy[0][1]=12;
hardy[0][2]=66;
hardy[1][0]=54;
hardy[1][1]=43;
hardy[1][2]=36;
32 12 66 54 43 36
0 1
0 1 2 0 1 2
TWO DIMENSIONAL ARRAY -
NON UNIFORM
• Int[][] hardy=newint[2];
• Mark[0]=newint[3];
• Mark[1]=newint[4];
0 1
0 1 2 0 1 2 3
MULTIDIMENSIONALARRAY
• Int[][][] hardy=newint[2][3][2];
0 1
0 1 2 0 1 2
0 1 0 1 0 1 0 1 0 1 0 1
Arrays in java oopj

More Related Content

PPT
Programming Logic and Design: Arrays
PDF
Arrays in Java
PPTX
Arrays in java
PPTX
Array in Java
PPTX
the array, which stores a fixed-size sequential collection of elements of the...
PPTX
JAVA WORKSHOP(DAY 3) 1234567889999999.pptx
PPTX
Array.pptx
PPTX
arraylist in java a comparison of the array and arraylist
Programming Logic and Design: Arrays
Arrays in Java
Arrays in java
Array in Java
the array, which stores a fixed-size sequential collection of elements of the...
JAVA WORKSHOP(DAY 3) 1234567889999999.pptx
Array.pptx
arraylist in java a comparison of the array and arraylist

Similar to Arrays in java oopj (20)

PPTX
Basic_Understanding_of_Arrays_in_Java_Quipoin.pptx
PPTX
Programming Basics - array, loops, funcitons
PDF
Javascript Arrays related PowerPoint slide set
PPTX
Lecture 9
PDF
Description of Static and dynamic arrays
PPTX
OOPs with java
PPTX
Java Programming Comprehensive Guide.pptx
PPTX
Arrays in java.pptx
ODP
Java for newcomers
PDF
1.7 Arrays in C++ and its detail........pdf
PDF
Java R20 - UNIT-3.pdf Java R20 - UNIT-3.pdf
PPT
JavaYDL6
PPTX
Arrays.pptx
PPTX
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_03-Feb-2021_L1_...
PDF
Java keywords
PPTX
Java 103 intro to java data structures
PDF
Keywords and classes
PPT
1. Overview of Java
PPTX
collectionsframework210616084411 (1).pptx
Basic_Understanding_of_Arrays_in_Java_Quipoin.pptx
Programming Basics - array, loops, funcitons
Javascript Arrays related PowerPoint slide set
Lecture 9
Description of Static and dynamic arrays
OOPs with java
Java Programming Comprehensive Guide.pptx
Arrays in java.pptx
Java for newcomers
1.7 Arrays in C++ and its detail........pdf
Java R20 - UNIT-3.pdf Java R20 - UNIT-3.pdf
JavaYDL6
Arrays.pptx
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_03-Feb-2021_L1_...
Java keywords
Java 103 intro to java data structures
Keywords and classes
1. Overview of Java
collectionsframework210616084411 (1).pptx
Ad

More from ShaishavShah8 (19)

PPTX
Diffie hellman key algorithm
PPTX
Constructor oopj
PPTX
Clipping computer graphics
PPTX
Classification of debuggers sp
PPTX
Parallel and perspective projection in 3 d cg
PPTX
Asymptotic notations ada
PPTX
Classical cyphers python programming
PPTX
Logics for non monotonic reasoning-ai
PPTX
Rdd transformations bda
PPT
Introduction to data warehouse dmbi
PPT
Lan, wan, man mcwc
PPT
Introduction to xml, uses of xml wt
PPTX
Agile process se
PPTX
Applications of huffman coding dcdr
PPTX
Cookie management using jsp a java
PPTX
Login control .net
PPTX
Rdd transformations
PPTX
LAN, WAN, MAN
PPTX
Introduction to data warehouse
Diffie hellman key algorithm
Constructor oopj
Clipping computer graphics
Classification of debuggers sp
Parallel and perspective projection in 3 d cg
Asymptotic notations ada
Classical cyphers python programming
Logics for non monotonic reasoning-ai
Rdd transformations bda
Introduction to data warehouse dmbi
Lan, wan, man mcwc
Introduction to xml, uses of xml wt
Agile process se
Applications of huffman coding dcdr
Cookie management using jsp a java
Login control .net
Rdd transformations
LAN, WAN, MAN
Introduction to data warehouse
Ad

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Cloud computing and distributed systems.
PPTX
Big Data Technologies - Introduction.pptx
PDF
Modernizing your data center with Dell and AMD
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
Advanced IT Governance
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
PDF
Empathic Computing: Creating Shared Understanding
PDF
Sensors and Actuators in IoT Systems using pdf
cuic standard and advanced reporting.pdf
Understanding_Digital_Forensics_Presentation.pptx
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Reach Out and Touch Someone: Haptics and Empathic Computing
Cloud computing and distributed systems.
Big Data Technologies - Introduction.pptx
Modernizing your data center with Dell and AMD
The Rise and Fall of 3GPP – Time for a Sabbatical?
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Review of recent advances in non-invasive hemoglobin estimation
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
Advanced Soft Computing BINUS July 2025.pdf
Advanced IT Governance
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
Empathic Computing: Creating Shared Understanding
Sensors and Actuators in IoT Systems using pdf

Arrays in java oopj