Unit 1: Java Introduction
Unit 1: Java Introduction
Unit 1
Java Introduction
¤ OOP CONCEPT ¤
● Encapsulation
● Inheritance
● Polymorphism
1. Encapsulation
Class
Private
Data
Public
Method
Public
Data
Private
Method
Communication Channel to External Components
Access to External
Components
Data
● Access Specifiers
1. Default (Friendly)
2. Public
3. Private
4. Protected
Java Note’s Pavan
2. Inheritance
3. Polymorphism
1. Safe:
Java does not provide any pointer like C & C++. So a
memory location of system can not be access thought
Java program, therefore any program develop in Java can
not be use hack a system.
Java Note’s Pavan
2. Robust:
Errors that occur at runtime can easily handle in Java.
3. Multithreaded:
Java language provides an environment by which
several task can be initiated and managed easily, such a
feature is called Multithreaded.
5. Internet Ready:
Java has several classes for Internet Programming,
which can be used for client server programming.
6. Simple:
Java is using syntax like C & C++ and that’s why Java
is simple language.
1. Application Program
Java can be use for writing programs that run in PC under the
control of the O.S. in that machine. Such programs are called
Application Program.
2. Applet Program
Programs can be written & compile to give what is called
Bytecodes.
¤ Java Architecture ¤
O/S
API
JVM
Source
Compiler
Bytecode
Java Architecture
● Java Virtual Machine executes Java class file and Java API
require for Java class file.
● Java API interacts with local O/S and API files have native
methods.
Java Program
Java Platform for Windows
Java Platform for Linux
Java Platform for Mac
Java
Program
Java Compiler
Virtual Machine
Java file
jdk
.class file
(byte code)
Java Note’s Pavan
● Explain JVM
Byte
code
Run with Java
Command
Machine Dependent
O/P
JVM + API
Java Environment
Java is proving JDK-Java Development Kit to compile
Java source code. It provides number of commands.
Java Note’s Pavan
Unit 2
Java Language Overview
¤ Literals ¤
¤ Data Types ¤
● In Java all types are sign and take positive & negative
values.
● True & false are not associated with any numerical value.
¤ Variables ¤
Java Note’s Pavan
Variables, as the name indicate take different
values during the execution of program.
Rules
Chapter 3
The Structure of a Java
Program
Class FirstProg
{
public static void main(String args[])
{
System.out.println(“First Program.”);
}
}
¤ Comments ¤
Ex. X= a*b/3+c
Java Note’s Pavan
¤ Type Conversion ¤
1. Automatic Promotion
2. Type Casting