Java Summer Training Report
Java Summer Training Report
SUMMER TRAINING
REPORT ON CORE JAVA
UNDERTAKEN
NEUMANN’S INSTITUTE OF
COMPUTER STUDIES
I
ELECTRONICS AND
COMMUNICATION ENGINEERING
carry out the project work in the area of console based portal designing during my training. I
would like to also thank my institute, BSA College Of Engineering &Technology, Mathura for
giving permission and necessary administrative support to take up the training work at
Deepest thanks to our Trainer Mr. Ashok Agrawal (Senior Trainer) for his guidance,
monitoring, constant encouragement and correcting various assignments of ours with attention
and care. He has taken pain to go through the project and training sessions and make necessary
NIDHI MITTAL
CONTENT
1. Acknowledgement...........................................................................................................i
2. Introduction.....................................................................................................................1
3. Organisation....................................................................................................................2
4. Basics Of Java.................................................................................................................2
4.1. Overview Of Java...................................................................................................2
4.2. Features Of Java.....................................................................................................3
4.3. Java ClassPath Setting............................................................................................4
4.4. Steps For Compiling And ExecutiPrograms..........................................................4
4.5. Difference Between JDK,JREJVM...................................................................5
4.6. Object And
Class........................................................................................................5
4.7. Data
Types..................................................................................................................6
4.8.
Variables.....................................................................................................................7
4.9. Operators And Its
Types..............................................................................................7
5. Programming Concepts......................................................................................................7
5.1. Structure Of Java Program..........................................................................................7
5.2. Main Method...............................................................................................................8
5.3. Decision Making Statement........................................................................................8
5.4. Looping Statement......................................................................................................8
5.5. Wrapper Classes..........................................................................................................9
5.6. Access Modifiers.........................................................................................................9
9. Java Advanced..................................................................................................................16
9.1. Package......................................................................................................................16
9.2. Exception Handling...................................................................................................16
9.3. Multithreading...........................................................................................................17
9.4. String..........................................................................................................................17
9.5. Collection...................................................................................................................18
10
Conclusions....................................................................................................................21
References....................................................................................................................22
INTRODUCTION
Gosling and there team. Originally SUN Micro Systems is one of the
Academic university (Standford University Network)
J2SE
J
J2SE is used for developing client side applications.
J2EE
J2EE is used for developing server side applications.
•J2ME
BASICS OF JAVA
Overview Of Java
Java is a platform independent, more powerful, secure, high performance,
multithreaded programming language. Here we discuss some points related to java
•JRE
The Java Runtime Environment (JRE) is part of the Java Development Kit (JDK).
It contains set of libraries and tools for developing java application. The Java
Runtime Environment provides the minimum requirements for executing a Java
application.
•JVM
JVM is set of programs developed by sun Micro System and supplied as a part of jdk
for reading line by line of byte code and it converts into native understanding form
of operating system. Java language is one of the compiled and interpreted
programming language.
•GARBAGE COLLECTOR
Garbage Collector is the system Java program which runs in the background along
with regular Java program to collect un-Referenced (unused) memory space for
improving the performance of our applications.
• API
An API (Application Programming Interface) is a collection of packages, a
package is the collection of classes, interfaces and sub-packages. A sub-
package is a collection of classes interfaces and sub sub packages etc.
Java programming is containing user friendly syntax so that we can develop
effective application
s. in other words if any language is providing user friendly syntax, we can
develop error free applications.
• JIT
JIT is the set of programs developed by SUN Micro System and added as a part
+-9.2of JVM, to speed up the interpretation phase
Features Of JAVA
Features of a language are nothing but the set of services or facilities provided
by the language vendors to the industry programmers. Some important features
are;
Java Classpath Setting
Path Variable
Path variable is set for providing path for all java tools like java, javac, javap,
javah, jar, appletviewer which are use in java programming. These all tools are
available in bin folders so we set path upto bin folders.
Classpath Variable
Classpath variable is set for providing path for predefined java classes which is
used in our application. All classes are available in lib/rt.jar so we set classpath
upto lib/rt.jar.
Steps For CompilingAnd Executing Programs
The following sequence of steps represented in the diagram use compiling the
java program and executing the java programs.
Jvm, Jre, Jdk these all the backbone of java language. Each
components have separate works. Jdk and Jre physically exists but
Jvm are abstract machine it means it not physically exists.
JVM : JVM (Java Virtual Machine) is a software. It is a specification that
provides runtime environment in which java bytecode can be executed. It not
physically exists.JVMs are not same for all hardware and software, for
example for window os JVM is different and for Linux VJM is different. JVM,
JRE and JDK are platform dependent because configuration of each OS differs.
But, Java is platform independent.
JRE : The Java Runtime Environment (JRE) is part of the Java Development
Kit (JDK). It contains set of libraries and tools for developing java application.
The Java Runtime Environment provides the minimum requirements for
executing a Java application. It physically exists. It contains set of libraries +
other files that JVM uses at runtime.
JDK : The Java Development Kit (JDK) is primary components. It physically
exists. It is collection of programming tools and JRE, JVM.
Object: Object is a instance of class, object has state and behaviors.An Object in
java has three characteristics:
•State
•Behaviour
• Identity
Variable
Variable is an identifier which holds data or another one variable is an
identifier whose value can be changed at the execution time of program. Variable
is an identifier which can be used to identify input data in a program.
PROGRAMMING CONCEPTS
Final keyword
In java language final keyword can be used in following way.
This keyword
this is a reference variable that refers to the current object. It is a keyword in
java language represents current class object
"this" keyword can be use in
two ways.
this . (this dot)
this() (this off)
Super keyword
Super keyword in java is a reference variable that is used to refer parent class
object. Super is an implicit keyword create by JVM and supply each and every
java program for performing important role in three places.
• At variable level
• At method level
• At constructor level
Synchronized keyword
Synchronized Keyword is used for when we want to allow only one thread at
a time then use Synchronized modifier. If a method or block declared as a
Synchronized then at a time only one thread is allowed to operate on the
given object.
Abstract Classes
We know that every java program must start with a concept of
class that is without classes concept there is no java program perfect.In java
programming we have two types of classes they are
1. Concrete class
2. Abstract class
Inheritance
The process of obtaining the data members and methods from one class to
another class is known as inheritance. It is one of the fundamental features
of object-oriented programming.
A class that is declared with abstract keyword, is known as abstract class. An
abstract class is one which is containing some defined method and some
undefined method. In java programming undefined methods are known as un-
Implemented or abstract method.The process of obtaining the data members
and methods from one class to another class is know as inheritance. It is one
of the fundamental features of object-oriented programming.
Types of Inheritance
Single inheritance
Multiple inheritance
Hierarchical inheritance
Multi level inheritance
Hybrid Inheritance
Why use Inheritance ?
• For Method Overriding (used for Runtime Polymorphism
• For Method Overloading (used for compiletime Polymorphism)
It's main uses are to enable polymorphism and to be able to reuse
code for different classes by putting it in a common super class
For code Re-usability
Method Overloading
Whenever same method name is exiting multiple times in the same class
with different number of parameter or different order of parameters or
different types of parameters is known as method overloading
Why method overloading?
Suppose we have to perform addition of given number but there can be
any number of arguments, if we write method such as a(int, int)for two
arguments, b(int, int, int) for three arguments then it is very difficult for
you and other programmer to understand purpose or behaviors of method
they can not identify purpose of method. So we use method overloading
to easily figure out the program. For example above two methods we can
write sum(int, int) and sum(int, int, int) using method overloading
concept.
Different ways to overload the method
Interface
Abstraction
Abstraction is the concept of exposing only the required essential
characteristics and behavior with respect to a context.
Hiding of data is known as data abstraction. In object oriented programming
language this is implemented automatically while writing the code in the form
of class and object.
Real life example of Abstraction
Abstraction shows only important things to the user and hides the internal
details for example when we ride a bike, we only know about how to ride bike
but can not know about how it work ? and also we do not know internal
functionality of bike.
Encapsulation
Encapsulation is a process of wrapping of data and methods in a single unit is
called encapsulation. Encapsulation is achieved in java language by class
concept.Combining of state and behavior in a single container is known as
encapsulation. In java language encapsulation can be achieve using class
keyword, state represents declaration of variables on attributes and behavior
represents operations in terms of method.
Benefits of encapsulation
•Provides abstraction between an object and its clients
•Protects an object from unwanted access by clients
Polymorphism
The process of representing one form in multiple forms is known as
Polymorphism.Here original form or original method always resides in base
class and multiple forms represents overridden method which resides in
derived classes.
Polymorphism is not a programming concept but it is one of the principal of
OOPs. For many objects oriented programming language polymorphism
principle is common but whose implementations are varying from one objects
oriented programming language to anotherobject oriented programming
language.
Polymorphism principal is divided into two sub principal they are:
Static or Compile time polymorphism
Dynamic or Runtime polymorphism
JAVA ADVANCED
Package
A package is a collection of similar types of classes, interface and sub-
packages. Purpose of package
The purpose of package concept is to provide common classes and interfaces
for any program separately. In other words if we want to develop any class or
interface which is common for most of the java programs than such common
classes and interfaces must be place in a package.
Exception Handling
The process of converting system error messages into user friendly error
message is known as Exception handling. This is one of the powerful feature
of Java to handle run time error and maintain normal flow of java application.
An Exception is an event, which occurs during the execution of a program,
that disrupts the normal flow of the program's Instructions.
Type of Exception
•Checked exception
•Unchecked exception
Multithreading
String
String is a sequence of characters enclosed within double quotes (" ") is known
as String.
Example: "Java Programming".
In java programming to store the character data we have a fundamental datatype
called char. Similarly to store the string data and to perform various operation
on String data, we have three predefined classes they are:
•Sting
•String buffer
•String builder
Collection
Collections in java is a framework that provides an architecture to store and
manipulate the group of
objects.All the operations that you perform on a data such as searching, sorting,
insertion,
manipulation, deletion etc. can be performed by Java Collections.Java
Collection simply means a single unit of objects. Java Collection framework
provides many interfaces (Set, List, Queue, Deque etc.) and classes (ArrayList,
Vector, LinkedList, PriorityQueue, HashSet, LinkedHashSet, TreeSet etc).
CONCLUSIONS
Google Group-javatechzone