Unit 1: Java Introduction
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
Safe:
1.
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
Application Program
1.
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.
Applet Program
2.
This bytecode can be downloaded from server & run under control
of local O.S. Such programs are called Applet Program.
Java provides one type of application which is GUI base & used in
Internet Programming to show different colors images or different
multimedia effects is called Applet Programs.
¤ Java Architecture ¤
● Object file is H/W dependent, but class file is not H/W dependent.
.java
Local OS
Java
Platform
javac
.class file
O/P
Java Environment
Kit
O/S
API
JVM
Source
Compiler
Bytecode
Java Architecture
● The source program is compiling using java compiler & java class
file is created.
● 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
ShareBCA.Com JAVA By Aadil Keshwani
Program
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.
● The range of integer value for all integer type is defined by Java
language and does not depend on the computer on which the
members are generated.
● True & false are not associated with any numerical value.
ShareBCA.Com JAVA By Aadil Keshwani
¤ Variables ¤
Rules
Chapter 3
The Structure of a Java Program
Class FirstProg
{
public static void main(String args[])
{
System.out.println(“First Program.”);
}
}
● Method name, first word is always small letter and first char of
second word is capital letter.
4. Void: The word void is a key-word and informs that the main
method being not return anything.
¤ Comments ¤
Ex. X= a*b/3+c
¤ Type Conversion ¤
1. Automatic Promotion
2. Type Casting