1 Java Introduction
1 Java Introduction
Java is a simple, secure, object oriented, platform independent, open source, robust,
multithreaded, dynamic, light weight, architectural, neutral, high performance, distributed,
evergreen programming language.
Since, Java can be used to develop all kinds of applications like a games, mobile application,
website, networking application etc. So, that we can say java is a programming .
It works with java . The minimum module that we should arrange is JSE.
It is s installable software as JDK.
Latest version is 1.1.0 (java 10).
This module is given to develop standalone application.
Standalone Application –
An application that is specific to in machine and can give service to 1 user at a time.
Ex :– Java program with main (-) single layer games , antivirus software etc.
CUI Application -
These app provides character based user interface and are not user friendly.
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
GUI Application – (Graphical user interface )
Enterprise Application :-
It is an integration of small and large components that we use to implement a business
solution for business organization .
Ex:- Flipkart.
The application which helps the organization directly and indirectly and also it can
generate business or business organization.
The application that deals with complex large scale and high end logic is called
enterprise application.
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
There are 2 types of enterprise application :-
1) Web Application.
2) Distributed Web Application.
1) Web Application :-
A web application is also called as website.
It is client server application that interacts with each other .
In a web application client is fixed browser and server is software application
in which client can communicate directly to server .
www.gmail.com
Request
Web
Web page
page
Response
Distributed Application :-
The client server application that can use different protocols for communication is called
distributed application.
Server source
Payment
www.irc visa sbi
tc.co.in Request Request Request Request
gateway
cbi
Rupay
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
Frame Work :-
The readily available structure which is used for developing application is known as
framework.
Frame work provides common services like security, logging, management etc.
Frame work provides abstraction layer on technology.
Ex :- Soap, Restful.
\
Language independent + Platform independent = Inter operatsbility
Servlet.
JSP (Java server page ).
EJB (Enterprise java bear ).
JMS (Java message service ).
The application that can be developed in regular computer but can be dumped to
electronic chip and that electronic chip imported to hardware machine for execution is
called embedded system applications.
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
CORE JAVA -
Core java provides the fundamental building blocks which are used in constucting java
application in real time.
The core java language provides the following concepts required in real time.
1) Language fundamentals.
2) Object oriented programming.
3) Exception handling.
4) String handling.
5) Multithreading.
6) Collection.
ADVANCED JAVA –
Advanced java provides the integration of components in real time.
Handling non-primitive data type ( class, array, interface, enum) is called object oriented
programming.
1) Class
2) Object
3) Abstraction
4) Encapsulation
5) Polymorphism
6) Inheritance
Note :- Class is the collection of data and methods. ( class is the blue print of object).
Object :-
The Physical memory generated for the class or the physical existence of the class is
known as object.
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
Note :- Objects ponding are created within heap area of JVM architecture while classes
Abstraction :-
Hiding the internal implementation and just highlight the set of services is the concept of
abstraction.
Note :- We can achieve abstraction process by using abstract class and interfaces.
Encapsulation :-
The process of binding data member and corresponding member function in a single unit
is called encapsulation (security).
Polymorphism – (Flexibility) :-
The process of extracting more than one of behavior by same compnent is known as
polymorphism.
Inheritance – (Reusability) :-
The process of extracting the features of existing class in to a new class is known as
inheritance.
Objective Code :-
The code which is generated after compilation stage of C and C++ program is called
objective code.
Byte code :-
Every instructions of source code represented as one or more than are 8 bit notation.
Byte code is not a machine dependent code it is decoded and executed by JVM.
The byte code which is generated on one platform can be executed in all
platforms is known as platform independent.
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
Note :- Java is portable language because of its independency.
Java Is Simple :-
Ques :- Why memory managements and pointers removed from the hands of
developer ?
Ans :- To prevent the class lockage, pointers and memory management removed from
the hands of developers. Which made the java language robust nad secure.
The author of java language is James Gosling . He released the version by 1995.
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
JDK – (Java Development Kit) :-
By using JDK we can write the program compile the program, debug (if errors), link the
java library and executed.
Java Compiler :-
Java compiler is available within JDK it converts java source code to byte code because
JVM understands only byte code.
JVM is a software module which runs independently to execute java byte code.
JVM Architecture :-
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
JVM Architecture :-
In compilation stage of java language , no memories are generated , all the memories are
generated at run time on JVM . Because of this reason java language is also known as
dynamic programming language.
1) Loader
2) Linker
3) Initiate
1) Loader :-
It will take the responsibility of loading the required file into current running program.
This loader internally uses the following sub loader –
Application class loader :- It will load the required files from the class path of
environment variables.
Bootstrap class loader :- It will load the files from java library.
Extension class loader :- The extension class loader the required file from the
extension folder.
2) Linker :-
The linker will take the responsibility of linking the loaded files into current running
program.
The following components of linker will perform action –
1. Verity
2. Prepare
3. Resolve
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
1. Verity :- Verity component will check the code weather it is correct or not
after linkage.
2. Prepare :- When the verity component is true, the prepare component
decodes the program into programming components. Like data part and
method part.
3. Resolve :- The resolve components whether it is static or non- static .
Note :- Static component will get memory within the class of method area and non- static
component will get the memory with in the object of heap area.
Initiate :- This components will start creating memory in run time data area.
1) Method Area
2) Heap Area
3) Java Stack Area
4) Pc Register Area
5) Native Method Area
Method Area :-
The memory block where class static is loaded is known as method area. While class is
being loaded the static programming component will get the memory within the class .
The main (-) method copied into java stack area and starts the execution.
Heap Area :-
The memory block where objects are created is known as heap area .
While object creation the non- static programming components of class will get the
memory with in the object.
Coding Rule :-
Static components are excess by using class name. And non-static components are
excessed with object name.
The memory block where the methods are executed is known as java stack area.
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
Note :- The first method copied into java stack area is known as main method. This main
method will call remaining methods for execution.
Pc Register area :-
Pc register will manage execution of methods in java stack area. All these pc registers are
opened in a separate memory block is known as pc register area.
The methods which are declared by using native keyword are known as native code, these
methods are constructed from C & C++ programming language.
Note :- Java software is platform dependent but the application running on java software
is platform independent.
Execution Engine :-
1) Interpreter
2) JIT Compiler
The execution process is under the control of interpreter because of this reason java is
also known as interpreted language.
Interpreter execution the normal instruction & JIT compiler executes repetative statements.
It participates in execution process to execute native methods. While execution JNI Interects
with native method library.
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
Simple Structure of Java programming :-
Class ClassName
// data
// method
Main (-)
Java Library :-
Ex :- Java . long
Java Library
Package Java.lang
Step -1 :- Open text editor (Edit Plus) and type the program.
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]
a) Type cmd in run or search box.
b) Press enter.
c) C:/User/ Raja>....
d) C:/User/ Raja> D:
e) D:/ >cd Demo0904
f) D:/Demo0904>
Java ClassName
Ex :- java FirstProgram
Note :- After installation we can find the folder with name java in program files
C:/program files(X86)/java /Jdk 1.8.8-112/bin.
Var.Name Path
Var.Value
50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]