Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

INTRODUCTION TO

JAVA
JAVA
● It is a general purpose object oriented programming language developed by Sun Micro System of USA
in 1991
● First name of Java is “oak” , it was renamed as Java in 1995
● Derives much of its character from c,c++
OBJECT ORIENTED CONCEPTS
● Object
● Class
● Encapsulation
● Abstraction
● Polymorphism
● Inheritance
JAVA RUNTIME ENVIRONMENT
A software program needs an environment to run .

The runtime environment loads class files and ensures there is access to memory and other system resources
to run them.
Java Development Kit(JDK)
It is a software development environment used for developing and executing Java applications and applets.
JAVA VIRTUAL MACHINE
● JVM is a virtual machine that resides in the real machine(your computer) and the machine language
for JVM is bytecode.
● The Java compiler generate byte code for JVM rather than different machine code for each type of
machine.
● JVM executes the byte code generated by compiler and produce output.
Features of Java

● Object Oriented
● Simple
● Secured
● Platform Independent
● Robust
● Portable
● Compiled and Interpreted
● Multithreaded
● Dynamic
GARBAGE COLLECTION IN JAVA

● Languages like C/C++ don't support automatic garbage collection, however in java, the garbage
collection is automatic
● The process of removing unused objects from heap memory is known as Garbage collection and
this is a part of memory management in Java.

The Garbage collector of JVM collects only those objects that are created by new keyword.
Data types in Java
Operators in java

● Arithmetic Operators
● Relational Operators
● Bitwise Operators
● Logical Operators
● Assignment Operators
● Conditional Operators
Relational operator
BITWISE OPERATOR
LOGICAL OPERATOR
ASSIGNMENT OPERATOR
Java Program Structure
OBJECT CREATION IN JAVA
Java Class Methods
Methods are declared within a class ,and that they are used to perform certain actions.
CONSTRUCTORS IN JAVA
A constructor is used to initialize
objects.

The constructor is called when an


object of a class is created.

It has the same name of the class in


which it resides and has no explicit
return type
INHERITANCE

● subclass (child) - the


class that inherits from
another class
● superclass (parent) - the
class being inherited from
● Helps in code reusability
● To inherit from a class,
use the extends
keyword.
METHOD OVERLOADING
● Multiple methods can have the same name with different parameters.
● Increases readability of the program
METHOD OVERRIDING
If subclass( child class) has the same method as declared in the parent class, it is method overriding.

You might also like