Online Summer Training Report
on
JAVA Programming: Solving Problems with Software
Submitted by
III Year 5th semester
Submitted to
Ma’am Taruna Khemwani
Govt. Women
Engineeri College, Ajmer
ng
INDEX
Acknowledgement
Certificate
Abstract
Introduction
Objective of Training
Technology Learned
Outcomes of Training
Conclusion
Reference
ACKOWLEDGEMENT
It is my privilege to acknowledge the thanks of gratitude towards coursera
instructor, for their kind of valuable effort and guidance who taught
each and every thing about the course so gracefully.
I wish to acknowledge my deep gratitude to our teachers whose effort and
guidance plays a crucial role in their training.
I came to know about so many thing during this training.
ABSTRACT
JAVA was developed by James Gosling at Sun Microsystems_Inc in the
year 1991, later acquired by Oracle Corporation. It is a simple
programming language. Java makes writing, compiling, and debugging
programming easy. It helps to create reusable code and modular
programs.
JAVA is a class-based, object-oriented programming language and is
designed to have as few implementation dependencies as possible. A
general-purpose programming language made for developers to write
once run anywhere that is compiled Java code can run on all platforms
that support Java. Java applications are compiled to byte code that can
run on any Java Virtual Machine. The syntax of Java is Similar to
C/C++.
Introduction to java
JAVA is Object Oriented Programming as well as Platform.
JAVA is a first programming language which provide the concept of
writing program that can be executed using the web.
FEATURES OF JAVA
JAVA is Simple.
JAVA is Object Oriented.
JAVA is Distributed
JAVA is Interpreted and Compiled
JAVA is Secure
JAVA is Portable
JAVA is Multi-Threaded
Types of java application
There are mainly 4 types of application that can be created using java
programming:
1. WEB APPLICATION
An application that runs on the server side and creates dynamic page,
is called web application. Currently, servlet, jsp, struts, jsf etc.
Technologies are used for creating web applications in JAVA.
2. MOBILE APPLICATION
An application that is created for mobile devices. Currently Android
and Java ME are used for creating mobile applications.
3. STANDOLINE APPLICATION
It is also known as desktop application or window-based application.
An application that we need to install on every machine such as media
player, antivirus etc. AWT and Swing are used in JAVA for creating
standalone applications.
4. ENTERPRISE APPLICATION
An application that is distributed in nature, such as banking
application etc. It has the advantage of high level security, load
balancing and clustering. In java, EJB is used for creating enterprise
applications.
Java development kit
Jdk is a free software development package from sun microsystem.
Java development kit (jdk) contains tools needed to develop the
java program, and JRE to run the program the basic tools are-
APPLETVIEWER - run and debug without a web browser
JAVA – the java interpreter runs the java applets &application by
reading and interpreting byte code files. the same launcher is used
for deployment and development purpose.
JAVAC- this is the core of java, which translates the java source
code to bytecode files that the interpreter can understood
JAVADOC – it is used to generate API documentation
JAVAH – produce header files for use with native methods.
JAVAP – java disassembler, which enable us to convert
byetecodefiles
Into a program description.
JDB – java debugger, which helps us to find errors in our program
Compiled & interpreted
Java is both a compiled and interpreted language
Java compiler generates platform-independent byte codes
that are interpreted into machine readable instructions by a
java virtual machine(java interpreter) at run time.
Platform-independent and
portable
Java programs are designed to work in a networked
environment on a variety of computers and operating
systems.
The size of the primtive data types are machine
independent.
Compiler generate platform independent byte codes rather
than native machine code, so it can be implemented on
any machine.
Multithreaded
This feature allows us to handle multiple tasks
simultaneously.
Degined to run multiple threads.
Easy to implement.
Others systems have provided facilities via light
weight libraries, but java has in-built language support.
Great for multimedia displays.
Object-oriented
All coding and data reside within object and classes.
Java has built-in exception handling.
Everything in java (except the primitive data types) is an
object.
The object model in java is simple and easy to extend so that
complex programing problems can be reduced to simple
solutions.
Extensive set of classes, arranged in packages e.g. Java.awt,
java.io, java.net.
Object Oriented Programming
in JAVA
OOP is a method used for designing a program using classes and objects.
OOP aims to implement real world entities like inheritance,
polymorphism, hiding, abstraction, etc. It follows bottom-up
approach.
Advantages of OOP:
OOP is faster and easy to execute.
OOP provides the clear structure of program.
Concept of OOP
1. Class
2. Object
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation
Classes and Objects
A class is a user defined prototype from which objects are created. It
represent a set of properties or methods that are common to all
objects of one type.
A class declaration includes:
i. Modifiers: A class can be public, private, protected.
ii. Class keyword: used to create a class.
iii. Class name: It should begin with an initial letter.
iv. Body: The class body surrounded by braces {}.
Objects
An Object basic unit of OOP and represent the real life
entities. A java program creates many objects, interact
by invoking methods.
An object consists of:
i. State
ii. Behavior
iii. Identify
Declaring Object: It is also called instantiating a class. When
an object of a class is created is said to be instantiated.
Initializing an Object: The new operator instantiates a class
by allocating memory for a new object and returning a
reference to a memory.
Methods in JAVA
A method is a collection of statements that perform a specific task and represent the
behavior of a class.
Syntax: public void name (String args[])
{
//method body
}
Constructor in JAVA
• A constructor in Java is a method used to initialize an object.
• The constructor is called when an object of class is created. It has same name as
its class.
• Constructor have no explicit return type.
• All classes have constructors as java automatically provides a default constructor.
1. No argument constructor: This constructor means that it does not accept any
parameters.
2. Parameterized constructor: This constructor accepts one or more parameters.
Inheritance
Inheritance is a mechanism in java by which one class is allowed
to inherit the feature and properties of another class.
• Super class: The base or parent class.
• Sub class: The class that inherit the other class (derived or extended
or child class).
• Reusability: In this, when we create a new class and there is already
exist class that includes some function, we can derive our new class
from the existing class.
The extend keyword is used for inheritance in java.
Syntax: class derived extends base
{
//methods and fields
}
Types of Inheritance in JAVA
1. Single Inheritance: In this, subclass inherit the features of one
superclass.
2. Multilevel Inheritance: A derived class will be inheriting a base class and as
well as the derived class also act as the base class to other class.
3. Hierarchical Inheritance: One class serves as a superclass for more than
one subclass.
4. Multiple Inheritance: This type of inheritance can be achieved by interfaces.
In this one class can have more than one superclass and inherit features from all
parent classes.
Polymorphism
Polymorphism is the ability of an object to take more than one
form. It perform a single action in multiple ways.
Two types of polymorphism-
1. Compile-time polymorphism:
In this, the call to the method is resolved at compile-time.
Compile-Time polymorphism is achieved through Method
Overloading.
2. Run-time polymorphism:
In this, the call to an overridden method is resolved dynamically
at runtime.
Runtime polymorphism is achieved through Method Overriding.
Method overloading: It is a process that can create
multiple methods of the same name in the same class, and
all the methods work in different ways. Method
overloading occurs when there is more than one method of
same name.
Method overriding: It is defined as a process when the
subclass or a child class has the same method, parameter and
return type as declared in the parent class. then that function
overrides the function in the superclass.
Interfaces in JAVA
An interface is a collection of abstract methods. A class implements an
interface, thereby inheriting the abstract method of the interface.
• An interface contains behavior that a class implements.
• The interface keyword is used to declare an interface.
• A class uses the implements keyword to implement an interface.
• The extends keyword is used to extend an interface.
Interfaces have the following properties −
An interface is implicitly abstract.
Each method in an interface is also implicitly abstract.
Methods in an interface are implicitly public.
Outcomes of training
1. Outcomes of training are the measureable goal that we achieve at the end
of the training/ workshop.
2. After training, I will understand OOP concepts and procedures of
Java. Simply, understanding how to do something.
3. Identify the major elements about a new course, familiar with problem
solving programming.
CONCLUSION
In the overall training, We are grateful to Coursera, which
provide so many valuable courses. I have learned many things
and gain more new knowledge in JAVA. Moreover, the internship
program of 30 days duration has exposed me some programming
ethics.
As conclusion, the overall training experience from what I
have get and studied from videos. By having this great
experience, a new level of knowledge, skills and ethics I get.