Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Class notes java

Rating
-
Sold
-
Pages
20
Uploaded on
12-07-2022
Written in
2020/2021

Basic and important points about Arrays in java

Institution
Course

Content preview

Jav
aAr
ray
s

Ar
ray
sar
eobj
ect
swhi
chst
oremul
ti
plev
ari
abl
esoft
hesamet
ype.I
tcan
hol
dpr
imi
ti
vet
ypesaswel
lasobj
ectr
efer
ences.


Feat
uresofAr
ray

1.Arr
aysareobject
s
2.Theycanevenholdthereferencevar
iabl
esofotherobj
ects
3.Theyarecr
eatedduri
ngr unti
me
4.Theyaredynamical
l
ycreatedont heheap
5.TheArrayl
engthisfi
xed.sizecannotbechangeddynamical
ly
.

Ar
rayDecl
arat
ion
Decl
ari
nganar
raywhi
chhol
dsel
ement
sofi
ntegert
ype.

i
nt[]a;//r
efer
encev
ari
abl
ecapabl
eofr
efer
ri
ngt
oanar
rayofi
nteger
el
ements.

i
nta[]
;//l
egal
butl
esspr
efer
abl
e

doubl
e[]s;

l
ong[]l
ongAr
ray
;
f
loat[]f
loat
Arr
ay;



i
nt[
5]scor
es;
//i
ll
egal

JVM doesn’
tal
locatet
hespaceunt
ily
oui
nst
ant
iat
ethear
rayobj
ect
(cr
eatearr
ayobject
)

Decl
areandcr
eat
ear
rayobj
ect

,i
nt[
]scor
es;

scor
es=newi
nt[
6];




Decl
are,
const
ructandi
nit
ial
i
zet
hear
ray


i
nta[]=newi
nt[
6];/
/Decl
are,
Const
ruct
ionoft
hear
ray
a[
0]=0
a[
1]=0


a[
0]=1
a[
1]=2


i
nt[]anAr
ray=newi
nt[]{
1,2,
3,4,
5};


St
udent[]st
;
St
udent[]st
=newSt
udent
[6]
;

st
[0]
=newSt
udent
();/
/def
inest
udentcl
assear
li
ert
othi
s

st
[1]
=new st
udent
();




i
nt[]scor
es=newscor
es[]
;//compi
l
ati
oner
ror

i
ntx=4;

, i
nt[]dot
s={
3,5,
x,
9};

dot
s[2]hasv
alue4;

i
nt[]anAr
ray=newi
nt[]{
1,2,
3,4,
5};


Thr
ead[]t
hreads;/
/Ar
rayofObj
ectr
efer
ences

St
udent[
]st
=newSt
udent
[4]
;

St
[0]wi
l
lref
err
ingt
onul
lval
ue;

Thr
eadt
hreads[]
;//l
egalbutl
essr
eadabl
e



Pr
ocessi
ngAr
rayEl
ement
s
Accessi
ngAr
rayEl
ement
s

cl
assArr
ayExample{
publ
icstat
icvoi
dmain(
Str
ing[
]ar
gs){

/
/cr eat
eanarr
ay
i
nt[]age={12,
4,5,
2,5}
;

/
/accesselementsofthearray
f
or(inti
=0; i
<5; ++i
){
Sy
stem.out.
pri
ntl
n("
Elementati
ndex"+i
+":
"+age[
i]
);
}
}
}


Jav
asuppor
tsI
ndexedbasedAccess/Random accessoft
heel
ement
s
usi
ngi
ndex.

Written for

Institution
Course

Document information

Uploaded on
July 12, 2022
Number of pages
20
Written in
2020/2021
Type
Class notes
Professor(s)
Mohammed zaid
Contains
All classes

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
zaidulhaque

Get to know the seller

Seller avatar
zaidulhaque krishnaveni talent school
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
1
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions