0% found this document useful (0 votes)
4 views18 pages

Lecture 4

The document outlines the syllabus for a Java Programming course, focusing on the principles of Object-Oriented Programming. It covers the basics of Java, including the Java Virtual Machine (JVM) architecture, and provides instructions for executing a simple Java program. Key concepts such as class declaration, access modifiers, and the compilation process are also discussed.

Uploaded by

Deepak Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views18 pages

Lecture 4

The document outlines the syllabus for a Java Programming course, focusing on the principles of Object-Oriented Programming. It covers the basics of Java, including the Java Virtual Machine (JVM) architecture, and provides instructions for executing a simple Java program. Key concepts such as class declaration, access modifiers, and the compilation process are also discussed.

Uploaded by

Deepak Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

UNIVERSITY INSTITUTE COMPUTING

BSc (CS)/ BCA


Subject Name: Java Programming
Code: 22SCT-351/22CAT-351

JAVA PROGRAMMING DISCOVER . LEARN . EMPOWER


1
Syllabus
Unit-I
Principles of Object-Oriented Programming

• Introduction: Introduction to Java, Basic Features, JVM Concepts, A Simple Java


Program, Primitive Data Type and Variables, Java Keywords,.

2
Content
(Unit I)
Principles of Object-Oriented Programming
Chapter 1.1:
Lecture1.1.4-
1. First Java Program
2. JVM Architecture

3
Objectives/Outcomes

CO1: Identify the ways to implement the inheritance concept in


the Java programming language.

4
First Java Program
• The requirements for Java Program
execution:
• Install the JDk
• Set path of the jdk/bin directory.
• Create the java program
• Compile the java program
• Run the java Program

• Write the code given on the right side as


save the file as Hello.java

5
Executing Java Program
• To execute the java program
• Open command prompt
• select the folder where the program file
is saved
• write command: javac Hello.java
• upper command is used to compile the
program
• Write : java Hello
• java then class name (Hello) executes
the program and displays the output

6
Compilation Flow

Fig 1: Compilation Flow[1]

7
Parameters used in First Java
Program

• class keyword is used to declare a class in java.


• public keyword is an access modifier which represents visibility. It means it is
visible to all.
• static is a keyword. If we declare any method as static, it is known as the static
method. The core advantage of the static method is that there is no need to create an
object to invoke the static method.

8
Parameters used in First Java
Program contd.

• void is the return type of the method. It means it doesn't return any value.
• main represents the starting point of the program.
• String[] args is used for command line argument. We will learn it later.
• System.out.println() is used to print statement. Here, System is a class, out is the
object of PrintStream class, println() is the method of PrintStream class. We will
learn about the internal working of System.out.println statement later.

9
JVM
• JVM (Java Virtual Machine) is an abstract machine. It is a specification that
provides runtime environment in which java bytecode can be executed.
• JVM is a part of Java Run Environment (JRE).
• In other programming languages, the compiler produces machine code for a
particular system. However, Java compiler produces code for a Virtual Machine
known as Java Virtual Machine.
• JVM is responsible for allocating memory space.

Fig 2: JVM[2]

10
JVM Architecture

Fig 3: JVM Architecture[3]

11
JVM Architecture Contd.

1. ClassLoader : The class loader is a subsystem used for loading class files. It
performs three major functions viz. Loading, Linking, and Initialization.
2. Method Area: JVM Method Area stores class structures like metadata, the
constant runtime pool, and the code for methods.
3. Heap: All the Objects, their related instance variables, and arrays are stored in
the heap. This memory is common and shared across multiple threads.

12
JVM Architecture Contd.

4. JVM language Stacks: Java language Stacks store local variables, and it’s
partial results. Each thread has its own JVM stack, created simultaneously as
the thread is created. A new frame is created whenever a method is invoked,
and it is deleted when method invocation process is complete.
5. PC Registers: PC register store the address of the Java virtual machine
instruction which is currently executing. In Java, each thread has its separate
PC register.

13
JVM Architecture Contd.
6. Native Method Stacks: Native method stacks hold the instruction of native
code depends on the native library. It is written in another language instead of
Java.
7. Execution Engine: It is a type of software used to test hardware, software, or
complete systems. The test execution engine never carries any information
about the tested product.
8. Native Method Interface: The Native Method Interface is a programming
framework. It allows Java code which is running in a JVM to call by libraries
and native applications.
9. Native Method Libraries: Native Libraries is a collection of the Native
Libraries(C, C++) which are needed by the Execution Engine.

14
Difference

Fig 4: Differences[4]
15
References
• https://www.javatpoint.com/simple-program-of-java
• https://www.digimat.in/nptel/courses/video/106105191/L03.html
• https://www.geeksforgeeks.org/jvm-works-jvm-architecture/
• https://www.guru99.com/java-virtual-machine-jvm.html
• https://www.javatpoint.com/difference-between-jdk-jre-and-jvm
• https://www.guru99.com/difference-between-jdk-jre-jvm.htm

16
References
• Fig 1: Image source: https://www.javatpoint.com/simple-program-of-java
• Fig 2: https://www.guru99.com/java-virtual-machine-jvm.html.
• Fig 3: https://www.guru99.com/java-virtual-machine-jvm.html.
• Fig 4: https://www.guru99.com/difference-between-jdk-jre-jvm.htm

17
THANK YOU

You might also like