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
ShareBCA.Com JAVA By Aadil Keshwani
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
ShareBCA.Com JAVA By Aadil Keshwani
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.
ShareBCA.Com JAVA By Aadil Keshwani
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 ¤
.java
Local OS
Java
Platform
javac
.class file
O/P
Java Environment
Kit
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
ShareBCA.Com JAVA By Aadil Keshwani
Java Compiler
Virtual Machine
Java file
jdk
.class file
(byte code)
● Explain JVM
Byte
code
Run with Java
Command
Machine Dependent
O/P
JVM + API
Java Environment
ShareBCA.Com JAVA By Aadil Keshwani
Unit 2
Java Language Overview
¤ Literals ¤
¤ Data Types ¤
ShareBCA.Com JAVA By Aadil Keshwani
● In Java all types are sign and take positive & negative
values.
● True & false are not associated with any numerical value.
Int 0
Long 0L
Float 0.0F
Double 0.0D
Boolean False
¤ Variables ¤
Rules
Chapter 3
ShareBCA.Com JAVA By Aadil Keshwani
Class FirstProg
{
public static void main(String args[])
{
System.out.println(“First Program.”);
}
}
¤ Comments ¤
Ex. X= a*b/3+c
¤ Type Conversion ¤
1. Automatic Promotion
2. Type Casting