Unit 3
Unit 3
INTRODUCTION TO OOPs
Introduction - need of object oriented
• Object-Oriented-Everything in Java is an
object. We organize our software as a
combination of different types of objects that
incorporates both data and behavior
• Robust- strong
– It uses strong memory management
– lack of pointers it avoids security problems
– There is automatic garbage collection
– Exception handling
Java Features
• Architecture neutral- no implementation
dependent features, for ex: the size of
primitive types is fixed(32 bit 64 bit processor)
• An implementation Its implementation is
known as JRE (Java Runtime Environment)
4) Stack :
• Java Stack stores frames. It holds local variables and partial
results
• Each thread has a private JVM stack, created at the same
time as thread
• A new frame is created each time a method is invoked. A
frame is destroyed when its method invocation completes
5) Program Counter Register: PC (program
counter) register contains the address of the
Java virtual machine instruction currently
being executed
• Comments:
– single-line
– multi-line
– documentation
• Single-line Comment: It starts with a pair of
forwarding slash (//)
Ex: package computer;
public static void main(String args[])
{
}
• Methods and behavior :we define the functionality of the
program by using the methods. The methods are the set of
instructions that we want to perform.
class Demo
{
public static void main(String args[])
{
void display()
{
System.out.println("Welcome");
}
}
}
• installation of JDK