Introduction to Java
JAVA PROGRAMMING
Objectives
▪ Become familiar with the Java language.
▪ Explore Java language editions.
▪ Become familiar with why Java language is important.
▪ Explore Java as an independent platform
▪ Become familiar with Java platform components (Java compiler, Java development kit
(JDK),
Java runtime environment (JRE), Java virtual machine (JVM) and Java just in time
compiler(JIT).
▪ Explore the relationship between JDK,JRE,JVM and JIT.
▪ Explore how Java program is processed
Procedural Programming
▪ Procedural programming: writing programs made of functions that perform specific
tasks
• Procedures typically operate on data items that are separate from the procedures
• Data items commonly passed from one procedure to another
• Focus: to create procedures that operate on the program’s data
Object-Oriented Programming
▪ Object-oriented programming: focused on creating objects
▪ Object: entity that contains data and procedures
• Data is known as data attributes and procedures are known as methods
◦ Methods perform operations on the data attributes
What is Java?
▪ Java is an object-oriented programming language.
▪ 1991 - Green Team started by Sun Microsystems.
▪ Designed to be for general purposes such as developing desktop applications,
web applications, mobile applications, games etc.
▪ It also known as “Write Once Run Any Where” language (WORA).
Java program
components
Java Development Editions
▪ Java Standard Edition (J2SE)
• J2SE can be used to develop client-side standalone applications or applets.
▪ Java Enterprise Edition (J2EE)
• J2EE can be used to develop server-side applications such as Java servlets, Java
ServerPages, and Java ServerFaces.
▪ Java Micro Edition (J2ME).
• J2ME can be used to develop applications for mobile devices such as cell phones.
▪ This course uses J2SE.
Components of Java Platform
▪ There are three interrelated components for Java platform:
• JDK (Java Development Kit)
• JRE (Java Runtime Environment)
• JVM (Java Virtual Machine)
JDK = JRE + Development Tools
JRE = JVM + Library Classes
Java Development Kit (JDK)
▪ The JDK is used to develop Java applications.
▪ JDK internally contains JRE.
▪ JDK contains
• Compiler (javac)
• Core class library
◦ [Link]
◦ [Link]
Java Development Kit (JDK)
▪ JDK contains
• Debugger (jdb)
• Bytecode interpreter: The JVM (java)
• Documentation generator (javadoc)
• Java Archive utility (jar)
• Others
▪ Without JDK we cannot build any Java program.
▪ Developers choose JDK by Java version and by package or edition.
Java Runtime Environment (JRE)
▪ The JRE is the responsible unit to run the Java program.
▪ Without JRE we cannot run Java program(JDK is used to build Java program,
whereas JRE is used to run Java program).
▪ JRE contains JVM.
▪ JRE contains all the inbuilt packages and class library files(e.g. lang , io, util, etc).
Java Virtual Machine (JVM)
▪ JVM platform independent.
▪ JVM is available for multiple operating systems,
and programs created with the JRE
will run on all of them.
▪ JVM takes .class files and
executes it by managing the memory.
Java Virtual Machine (JVM)
▪ JVM contains JIT (Just In Time Compiler), which improves the performance of
Java applications at run time
▪ JVM loads, verifies, and executes the code and provides the runtime environment.
▪ JVM plays a major role in Java memory management.
Java As Independent Computing Platform
(Portability)
▪ Portable means that a program may be written on one type of computer and then
run on a wide variety of computers, with little or no modification.
▪ Java byte code runs on the JVM and not on any particular CPU; therefore,
compiled Java programs are highly portable.
▪ JVMs exist on many platforms:
Java As Independent Computing Platform
(Portability)
Java IDE
▪ An integrated development environment (IDE) is a software application that helps
programmers develop software code efficiently. It increases developer productivity
by combining capabilities such as software editing, building, testing, and packaging
in an easy-to-use application.
▪ NetBeans
▪ Eclipse
▪ blueJ
▪ intellJ
▪ In this course we will use NetBeans IDE.
References
▪ Introduction to Java Programming, Comprehensive Version, Student Value
Edition, Daniel Liang, 12th Edition, Pearson 2019
▪ lecture Notes: [Link].
▪ lecture Videos: YouTube channel.
▪ How to install JDK & NetBeans IDE manual.