0% found this document useful (0 votes)
10 views

1 Java Introduction

Uploaded by

deveshjoshi1041
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

1 Java Introduction

Uploaded by

deveshjoshi1041
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Java Programming Language –

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 .

There are three modules of java -

JSE / J2SE JEE / J2EE JME / J2ME

JSE / J2SE (Java standard edition / Java 2 platform edition) –

It is the base module of remaining two module (JEE or JME).

 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.

There are 2 types of standalone software-

CUI App (console application) GUI APP (desktop application)

CUI Application -

These app provides character based user interface and are not user friendly.

Ex :– Java program with main method.

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 )

These application provides user friendly graphical user interface .

Ex :– Single layer game.

JSE module with two parts –

(1) Programming Language :-


 Language fundamentals.
 Object oriented programming.
 String handling.
 Exception handling.
 Multithreading.
 collections
(2) Technologies :-
 JDBC
 RMI (Remote method invocation).
 JNDI ( Java naming directory interface).
 C, C++, Java, C# are programming language .
 JDBC, JNDI, Servlet , JSP are java technology.
 Struts, spring, hibernate are java frame work.

JEE /J2EE module – (java enterprise edition / java 2 platform edition):-

 JEE module is not a installable software module.


 It is a set of specification providing rules and guidelines to develop web server
software like Tomcat and application server software like web logic.
 Working with these server is nothing but working with JEE module.
 JEE module is given to develop enterprise application. (web application and
distributed application).

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

Client (Browser) Server

Client (Browser) Server

Distributed Application :-
The client server application that can use different protocols for communication is called
distributed application.

 In which client is not a fixed browser it can be a software application.


 The application in which client can not communication to server directly is called
distributed web application.

Server source
Payment
www.irc visa sbi
tc.co.in Request Request Request Request
gateway

Client Irctc server Payment server


master union

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:- Spring (Interface ) – To develop all kinds of application.

Hibernate (Red hat) – To develop database application.

Define Web Services :-

The logical integration established between language independent and platform


independent websites is known as web services.

Ex :- Soap, Restful.

\
Language independent + Platform independent = Inter operatsbility

JEE Module Technology :-

 Servlet.
 JSP (Java server page ).
 EJB (Enterprise java bear ).
 JMS (Java message service ).

JME / J2ME – (java micro edition / java 2 platform micro edition) :-

 It is an installable software as MDK (Mobile development kit).


 It is useful to develop micro application (mobile application).
 We can develop embedded system application with the help of JME module.

Embedded System Application :-

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.

 We can use embedded system application for AI (Artificial intelligence).


 These application are normally small scale application in size but bigger in
performance.

Ex :- Robot , fully automated washing machine.

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.

Define Object Oriented Programming Language :-

Handling non-primitive data type ( class, array, interface, enum) is called object oriented
programming.

Java is not pure object oriented programming language.

Concept of object oriented programming –

1) Class
2) Object
3) Abstraction
4) Encapsulation
5) Polymorphism
6) Inheritance

Class :- Class is a templets which generates object in real time .

Note :- Class is the collection of data and methods. ( class is the blue print of object).

 Class are loaded and method area of JVM architecture.

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

Are being executed.

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.

 Objective code is machine dependent code.


 The objective code can not be executed is generated on one platform can not
be executed on another platform is known as another platform is known as
platform dependent.

Byte code :-

The 8 bit notation of java source code is known as 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 :-

 Java is simple because there is no external pointers in hand of developers.


 Java is simple because memory management is done by JVM (Garbage collector
(GC)) automatically.

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.

1996 JDK 1.0

1997 JDK 1.1

1998 JDK 1.2

2000 JDK 1.3

2002 JDK 1.4

2004 JDK 1.5

2006 JDK 1.6

2011 JDK 1.7

2014 JDK 1.8

2017 JDK 1.9

2018 JDK 1.10

Ques :- What is difference between JDK, Compiler, JRE and JVM ?

Ans :- Java JSE JDK


Java compiler
JRE
JVM

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.

 JDK contains both java compiler & JVM both.


 JDK must be installed on developer computer.

Java Compiler :-

Java compiler is available within JDK it converts java source code to byte code because
JVM understands only byte code.

JRE – (java Run Time Environment) :-

By using JRE we can link the java library and execute.

JRE contains only JVM.

JVM – (Java Virtual machine) :-

It decodes the byte code and execute the 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.

The JVM internally contains 3 components -

1) Class loader subsystem.


2) Run time data area.
3) Execution engine.

Class Loader Subsystem :-


It will load the java byte code on to JVM. While loading process the components of class
loader subsystem will perform actions.

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 –

1. Bootstrap class loader.


2. Application class loader.
3. Extension class 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.

Run Time Data Area :-

This run time data area divided into 5 blocks –

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.

Java Stack Area :-

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.

Native Method Area :-

The methods which are declared by using native keyword are known as native code, these
methods are constructed from C & C++ programming language.

 These methods are not user defined method.


 These are available from java library.
 Whenever we use native methods within the application these methods are
copied onto a separate memory block known as native method area.

Note :- Java software is platform dependent but the application running on java software
is platform independent.

Execution Engine :-

It contains two translator –

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.

JNMI – (Java Native Method Interface) :-

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 :-

We can represent java library with word java.

Java Library is collection of packages.

Ex :- Java . long

Java Library

Package Java.lang

Classes / Interfaces System.out

Data / Method Println ()

Writing, Saving , Compilation and Executing java program :-

Step -1 :- Open text editor (Edit Plus) and type the program.

Step -2 :- Save the program with .java extension.

Note :- compilation and execution is done on command prompt.


Opening command prompt –

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>

Step -3 :- Compile the program as follows...

Java ClassName

Ex :- java FirstProgram

Installing Java Software JDK and Setting Path :-

Step -1 :- Download JDK from oracle website.

Step -2 :- Install the software.

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.

Step -3 :- Set the path as follows

a) Right click on this Pc--->Properties-->Advance System Setting -->Environment


variable---> System variable--->Nem

Var.Name Path

Var.Value

Click on ok for 3 times

50, Lakhanpur Housing Society, Near Lucky Restaurant, Vikas Nagar 208024
Contact: +91 9794 687277, +91 6388305853
Web: www.bytecode.co.in, email: [email protected]

You might also like