COMP 006 Reviewer: Java Basic Program Structure COMP 006
IBITS Year 17 | A.Y. 2023-2024 First Semester Midterms
hat is Java?
W
● Ja va i s a h i gh-l evel , o bject-ori ented p rogra mmi ng l a ngua ge d evel oped b y S un Mi cros ys tems i n the
m i d-1990s . I t i s d es i gned to b e p l a tform-i ndependent, m ea ni ngtha tJa va p rogra ms ca nruno na nyd evi ce
tha t ha s the Ja va Vi rtua l Ma chi ne (JVM) i ns ta l l ed.
urpose Java
P
● Ja va i s vers a til e a nd wi del y us ed for va ri ous purpos es , i ncl udi ng:
○ Cros s -Pl a tform Compa tibi l i ty: Ja va progra ms ca n run on di fferent pl a tforms wi thout modi fica tion.
○ Object-Ori ented: Encoura ges modul a r a nd reus a bl e code through cl a s s es a nd objects .
○ S ecuri ty: Ja va p rovi des a s ecure runtime e nvi ronment, m a ki ng i t s ui ta bl e for n etworked a nd
d i s tri buted envi ronments .
○ Vers a til i ty: Us ed i n w eb d evel opment ( Ja va EE), m obi l e a pp d evel opment ( Androi d), e nterpri s e
a ppl i ca tions , a nd more.
asic Structure of Java Program
B
● Pa cka ges : Orga ni za tiona l uni ts for cl a s s es a nd i nterfa ces .
● Cl a s s es : Bl uepri nt for objects , conta i ni ng methods a nd fiel ds .
● Methods : Functions tha t perform s peci fic ta s ks .
● Va ri a bl es : Stora ge l oca tions for da ta .
● Comments : Annota tions i n the code for documenta tion.
C OMP 006: Data Structures and Algorithms Java Basic Program Structure 1
COMP 006 Reviewer: Java Basic Program Structure COMP 006
IBITS Year 17 | A.Y. 2023-2024 First Semester Midterms
Initialization of Variables and Array in Java
Input and Output in Java
C OMP 006: Data Structures and Algorithms Java Basic Program Structure 2
COMP 006 Reviewer: Java Basic Program Structure COMP 006
IBITS Year 17 | A.Y. 2023-2024 First Semester Midterms
If - Else Statement
Switch Statement
C OMP 006: Data Structures and Algorithms Java Basic Program Structure 3
COMP 006 Reviewer: Java Basic Program Structure COMP 006
IBITS Year 17 | A.Y. 2023-2024 First Semester Midterms
Loops
C OMP 006: Data Structures and Algorithms Java Basic Program Structure 4