0% found this document useful (0 votes)
20 views30 pages

Internship Report 2

This report details an internship conducted by Maheshwari V at Don Bosco Institute of Technology, focusing on Java programming. It covers various aspects of Java, including its features, applications, and core concepts such as JDK, JRE, and JVM, along with object-oriented principles like inheritance and polymorphism. The report serves as a partial fulfillment for the Bachelor of Engineering in Computer Science and Engineering at Visvesvaraya Technological University during the academic year 2022-2023.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views30 pages

Internship Report 2

This report details an internship conducted by Maheshwari V at Don Bosco Institute of Technology, focusing on Java programming. It covers various aspects of Java, including its features, applications, and core concepts such as JDK, JRE, and JVM, along with object-oriented principles like inheritance and polymorphism. The report serves as a partial fulfillment for the Bachelor of Engineering in Computer Science and Engineering at Visvesvaraya Technological University during the academic year 2022-2023.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 30

1

VISVESVARAYA TECHNOLOGICAL UNIVERSITY


JNANA SANGAMA, BELGAVI-590018

A Report on
Inter/Intra-institutional Internship (Course Code: 21INT49)
Report-2

Carried out at
DON BOSCO INSTITUTE OF TECHNOLOGY
BENGALURU - 560074
Submitted in partial fulfilment for

Bachelor of Engineering
In
Computer Science And Engineering

Submitted by

MAHESHWARI V
1DB21CS077

Under the Guidance of


Prof. Chaitra M
Assistant Professor
Department of Computer Science And Engineering
Don Bosco Institute of Technology

Department of Computer Science And Engineering


Don Bosco Institute of Technology
Kumbalagodu, Mysore Road, Bangalore-560 074
2022-2023
2

DON BOSCO INSTITUTE OF TECHNOLOGY


Kumbalagodu, Mysore Road, Bangalore-560 074

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CERTIFICATE

Certified that the Inter/Intra-institutional Internship (Course Code: 21INT49) work


carried out by Maheshwari V (1DB21CS077) is a bonafide work carried out at Don Bosco
Institute of Technology, in partial fulfilment for the award Bachelor of Engineering in
Computer Science And Engineering of Visvesvaraya Technological University, Belgavi,
during academic year 2022-2023. It is certified that all corrections/suggestions indicated for
Internal Assessment have been incorporated in the report deposited in the departmental
library. The Internship report has been approved as it satisfies the academic requirements in
respect of the work prescribed for the said degree.

Internship Mentor Professor and Head Principal


3

CONTENTS:

 Introduction to Java
 Features of Java
 JDK, JRE, JVM
 Application of Java
 History of Java
 Object and Class in Java
 Method in Java
 Constructor in Java
 Difference between Method and Constructor in Java
 Instance Variable in Java
 Java Static Keyword
 Inheritance in Java
 Types of inheritance in Java
 Aggregation in Java
 Java polymorphism
 Method Overloading in Java
 Method Overriding in Java
 Abstraction in Java
 Encapsulation in Java
 Java Package
 Java arrays
 Data types
 Variable
 Operators and its types
 Conclusion

INTRODUCTION TO JAVA:

3
4

Java was developed by James Gosling at Sun Microsystems in the


year 1995, 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++.

Java Language was initially developed for digital devices such as set-
top boxes, televisions, etc. now it is used for various types of
application development.

Java is a General-purpose, High level, and Object-Oriented


programming language to be used for writing software in the widest
variety of application domains.

Java is a Programming Language and a Platform, Java is used as


programming to develop Software Applications, and It is also used as
a Software Platform to run Java applications.

Java can be used to create complete applications that may run on a


single computer or be distributed among servers and clients in a
network.

Java is used to develop Standalone Applications/Desktop


Applications /window-based applications, Web Applications,
Enterprise Applications, and Mobile Applications.

4
5

FEATURES OF JAVA:

 Simple:
Java is very easy to learn, and its syntax is simple, clean, and easy to
understand. Java language is a simple programming language
because, It has removed many complicated and rarely-used features,
and there is an Automatic Garbage Collection.

 Object Oriented:

In java, everything is an object which has some data and behaviour.


Java can be easily extended since it is based on the Object model.

 Platform Independent:

Java code is compiled into intermediate format (bytecode), which


can be executed on any systems for which Java virtual machine is
ported. That means you can write a Java program once and run it
on Windows, Mac, Linux or Solaris without re-compiling. Thus the
slogan “Write once, run anywhere” of Java.

 High Performance:

Java is an interpreted language, so it will never be as fast as a


compiled language like C or C++. But, Java enables high performance
with the use of the “Just-In-Time (JIT) compiler”.

 Distributed:

Java is a distributed language. Programs can be designed to run on


computer networks. Java has a special class library for
communicating using TCP/IP protocols. Creating network
connections is very much easy in Java as compared to C/C++.

5
6

JDK, JRE, and JVM:

JDK, JRE, and JVM are core concepts of Java programming


language. We don’t use these concepts in programming. But, as Java
developers, we should know about them.

JDK:
Java Development Kit aka JDK is the core component of Java
Environment and provides all the tools, executables, and binaries
required to compile, debug, and execute a Java Program.
We can say that JDK is the superset of JRE since it contains JRE with
Java compiler, debugger, and core classes. JDK is a platform-specific
software and that’s why we have separate installers for Windows,
Mac, and Unix systems.

JRE:

It provides a platform to execute java programs. JRE consists of JVM,


Java binaries, and other classes to execute any program successfully.
JRE doesn’t contain any development tools such as Java compiler,
debugger, JShell, etc. If you just want to execute a Java program, you
can install only JRE. You don’t need JDK because there is no
development or compilation of Java source code is required.

JVM:

JVM is the heart of Java programming language. When we execute a


Java program, JVM is responsible for converting the byte code to the
machine-specific code. JVM is platform-dependent and provides core
java functions such as memory management, garbage collection,
security, etc.

6
7

APPLICATIONS OF JAVA PROGRAMMING:


 Desktop GUI Applications
 Mobile Applications
 Enterprise Applications
 Scientific Applications
 Web-based Applications
 Embedded Systems
 Big Data Technologies
 Distributed Applications
 Cloud-based Applications
 Web servers and Application servers
 Software Tools
 Gaming Applications
 Smart Cards

It is used by many Java enthusiasts for different purposes. By using


Java, we can develop a variety of applications such as enterprise
application, network applications, desktop applications, web
applications, games, android app, and many more.

HISTORY:

7
8

Java’s history is very interesting. It is a programming language


created in 1991. James Gosling, Mike Sheridan, and Patrick
Naughton, a team of Sun engineers known as the Green
team initiated the Java language in 1991. Sun Microsystems released
its first public implementation in 1996 as Java 1.0. It provides no-cost
-run-times on popular platforms. Java1.0 compiler was re-written in
Java by Arthur Van Hoff to strictly comply with its specifications.
With the arrival of Java 2, new versions had multiple configurations
built for different types of platforms.

In 1997, Sun Microsystems approached the ISO standards body and


later formalized Java, but it soon withdrew from the process. At one
time, Sun made most of its Java implementations available without
charge, despite their proprietary software status. Sun generated
revenue from Java through the selling of licenses for specialized
products such as the Java Enterprise System.

On November 13, 2006, Sun released much of its Java virtual


machine as free, open-source software. On May 8, 2007, Sun finished
the process, making all of its JVM’s core code available under open-
source distribution terms.

The principles for creating java were simple, robust, secured, high
performance, portable, multi-threaded, interpreted, dynamic, etc. In
1995 Java was developed by James Gosling, who is known as the
Father of Java. Currently, Java is used in mobile devices, internet
programming, games, e-business, etc.

Java programming language is named JAVA. Why?

After the name OAK, the team decided to give a new name to it and
the suggested words were Silk, Jolt, revolutionary, DNA, dynamic,
etc. These all names were easy to spell and fun to say, but they all
wanted the name to reflect the essence of technology. In accordance
with James Gosling, Java the among the top names along with Silk,
and since java was a unique name so most of them preferred it.

8
9

Java is the name of an island in Indonesia where the first


coffee(named java coffee) was produced. And this name was chosen
by James Gosling while having coffee near his office. Note that Java
is just a name, not an acronym.

OBJECT IN JAVA:

An object in Java is the physical as well as a logical entity, whereas, a


class in Java is a logical entity only.

Examples:

Pencil
Apple
Book
Bag
Board

An object is an instance of class.

Object Definitions:

o An object is a real-world entity.


o An object is a runtime entity.
o The object is an entity which has state and behavior.
o The object is an instant of a class.

CLASS IN JAVA:

A class is a group of objects which have common properties. It is a


template or blueprint from which objects are created. It is a logical
entity. It can’t be physical.

A class in Java contains:

9
10

o Fields
o Methods
o Constructors
o Blocks
o Nested class and interface

INSTANCE VARIABLE IN JAVA:

A variable which is created inside the class but outside the method is
known as an instance variable. Instance variable doesn’t get memory
at compile time. It gets memory at runtime when an object or instance
is created. That is why it is known as an instance variable.

METHOD IN JAVA:

In Java, a method is like a function which is used to expose the


behaviour of an object.

Advantage of Method:

o Code Reusability
o Code Optimization

In Java, there are two types of methods:

 User-defined Methods: We can create our own method based on


our requirements.
 Standard Library Methods: These are built-in methods in Java that are
available to use.

A Java method can perform some specific task without returning


anything. Methods in Java allow us to reuse the code without retyping
the code. In Java, every method must be part of some class that is
different from languages like C, C++, and Python.
CONSTRUCTOR IN JAVA:

10
11

In Java, a constructor is a block of codes similar to the method. It is


called when an instance of the class is created. At the time of calling
constructor, memory for the object is allocated in the memory.

It is a special type of method which is used to initialize the object.


Every time an object is created using the new() keyword, at least one
constructor is called.

It calls a default constructor if there is no constructor available in the


class. In such case, Java compiler provides a default constructor by
default.
There are two types of constructors in Java: no-argument constructor,
and parameterized constructor.

Rules for creating Java constructor:

 Constructor name must be the same as its class name.


 A Constructor must have no explicit return type.
 A Java constructor cannot be abstract, static, final, and
synchronized

Types of Java constructors:

 Default constructor (no-argument constructor).


 Parameterized constructor.

11
12

DIFFERENCE BETWEEN METHOD AND


CONSTRUCTOR:

JAVA STATIC KEYWORD:

The static keyword in Java is used for memory management mainly.


We can apply static keyword with variables, methods, blocks and
nested classes. The static keyword belongs to the class than an
instance of the class.

The static can be:

 Variable (also known as a class variable)


 Method (also known as a class method)
 Block
 Nested class

12
13

INHERITANCE IN JAVA:
Inheritance in Java is a mechanism in which one object acquires all
the properties and behaviours of a parent object. It is an important part
of OOPs (Object Oriented programming system).

Inheritance represents the IS-A relationship which is also known as


a parent-child relationship.

Terms used in Inheritance:

 Class: A class is a group of objects which have common


properties. It is a template or blueprint from which objects are
created.
 Sub Class/Child Class: Subclass is a class which inherits the other
class. It is also called a derived class, extended class, or child class.
 Super Class/Parent Class: Superclass is the class from where a
subclass inherits the features. It is also called a base class or a
parent class.
 Reusability: As the name specifies, reusability is a mechanism
which facilitates you to reuse the fields and methods of the existing
class when you create a new class. You can use the same fields and
methods already defined in the previous class.

TYPES OF INHERITANCE IN JAVA:

13
14

Single Inheritance Example:


When a class inherits another class, it is known as a single
inheritance. In the example given below, Dog class inherits the
Animal class, so there is the single inheritance.

14
15

Multilevel Inheritance Example:


When there is a chain of inheritance, it is known as multilevel
inheritance. As you can see in the example given below, Baby Dog
class inherits the Dog class which again inherits the Animal class, so
there is a multilevel inheritance.

15
16

Hierarchical Inheritance Example:


When two or more classes inherits a single class, it is known
as hierarchical inheritance. In the example given below, Dog and Cat
classes inherits the Animal class, so there is hierarchical inheritance.

16
17

AGGREGATION IN JAVA:
If a class have an entity reference, it is known as Aggregation.
Aggregation represents HAS-A relationship.

17
18

JAVA POLYMORPHISM:
Java Polymorphism means "many forms", and it occurs when we have
many classes that are related to each other by inheritance.

Polymorphism in Java is a concept by which we can perform a single


action in different ways. Polymorphism is derived from 2 Greek
words: poly and morphs. The word "poly" means many and "morphs"
means forms. So polymorphism means many forms.

There are two types of polymorphism in Java: compile-time


polymorphism and runtime polymorphism. We can perform
polymorphism in java by method overloading and method overriding.

Runtime Polymorphism in Java:

Runtime polymorphism or Dynamic Method Dispatch is a process in


which a call to an overridden method is resolved at runtime rather
than compile-time.

In this process, an overridden method is called through the reference


variable of a superclass. The determination of the method to be called
is based on the object being referred to by the reference variable.

Compile-time Polymorphism:

Compile-time polymorphism is also known as static polymorphism or


early binding. Compile-time polymorphism is a polymorphism that is
resolved during the compilation process. Overloading of methods is
called through the reference variable of a class. Compile-time
polymorphism is achieved by method overloading and operator
overloading.

Upcasting:

If the reference variable of Parent class refers to the object of Child


class, it is known as upcasting.

18
19

METHOD OVERLOADING IN JAVA:

If a class has multiple methods having same name but different in


parameters, it is known as Method Overloading.

If we have to perform only one operation, having same name of the


methods increases the readability of the program.

Suppose we have to perform addition of the given numbers but there


can be any number of arguments, if we write the method such as a(int,
int) for two parameters, and b(int, int, int) for three parameters then it
may be difficult for us as well as other programmers to understand the
behaviour of the method because its name differs.

So, we perform method overloading to figure out the program


quickly.

Different ways to overload the method:

1. By changing number of arguments

19
20

2. By changing the data type

The basic meaning of overloading is performing one or more


functions with the same name. Java provides the facility to overload
methods. The method overloading is a single class that can have
multiple methods with the same name, but they should differ in
signature or number of parameters and return type of the method. This
method overloading functionality benefits in code readability and
reusability of the program.

20
21

Features of Method Overloading:

 Since the method overloading is static polymorphism, i.e. methods


are binded during the compilation process.
 Overloading affects the at runtime, binding of methods is done at
compile-time, so many processes are not required during run time,
i.e. binding or checking.
 Only changing the return of the method does not consider
as method overloading. This results in an ambiguity error.
 The number of arguments, order of arguments and type of
arguments are part of the actual method overloading.

METHOD OVERRIDING:

If subclass (child class) has the same method as declared in the parent
class, it is known as method overriding in Java.

In other words, If a subclass provides the specific implementation of


the method that has been declared by one of its parent class, it is
known as method overriding.

Usage of Java Method Overriding:

 Method overriding is used to provide the specific implementation


of a method which is already provided by its superclass.
 Method overriding is used for runtime polymorphism.

Rules for Java Method Overriding:

 The method must have the same name as in the parent class.
 The method must have the same parameter as in the parent class.
 There must be an IS-A relationship (inheritance).

Example of Method Overriding:

In this example, we have defined the run method in the subclass as


defined in the parent class but it has some specific implementation.

21
22

The name and parameter of the method are the same, and there is IS-
A relationship between the classes, so there is method overriding.

ABSTRACTION IN JAVA:
Abstraction is a process of hiding the implementation details and
showing only functionality to the user.

Another way, it shows only essential things to the user and hides the
internal details, for example, sending SMS where we type the text and

22
23

send the message. We don't know the internal processing about the
message delivery.

Data Abstraction is the property by virtue of which only the essential


details are displayed to the user. The trivial or the non-essential units
are not displayed to the user. Ex: A car is viewed as a car rather than
its individual components.

Data Abstraction may also be defined as the process of identifying


only the required characteristics of an object ignoring the irrelevant
details. The properties and behaviour of an object differentiate it from
other objects of similar type and also help in classifying/grouping the
objects.

Consider a real-life example of a man driving a car. The man only


knows that pressing the accelerators will increase the speed of a car or
applying brakes will stop the car, but he does not know how on
pressing the accelerator the speed is actually increasing, he does not
know about the inner mechanism of the car or the implementation of
the accelerator, brakes, etc in the car. This is what abstraction is.

ENCAPSULATION IN JAVA:
Encapsulation in Java is a process of wrapping code and data together
into a single unit, for example, a capsule which is mixed of several
medicines.

We can create a fully encapsulated class in Java by making all the


data members of the class private. Now we can use setter and getter
methods to set and get the data in it.

The Java Bean class is the example of a fully encapsulated class.

JAVA PACKAGE :

23
24

A java package is a group of similar types of classes, interfaces and


sub-packages.

Package in java can be categorized in two form, built-in package and


user-defined package.

There are many built-in packages such as java, lang, awt, javax,
swing, net, io, util, sql etc.

Example:

JAVA ARRAYS:

24
25

Normally, an array is a collection of similar type of elements which


has contiguous memory location.

Java array is an object which contains elements of a similar data type.


Additionally, the elements of an array are stored in a contiguous
memory location. It is a data structure where we store similar
elements. We can store only a fixed set of elements in a Java array.

Array in Java is index-based, the first element of the array is stored at


the 0th index, 2nd element is stored on 1st index and so on.

In Java, array is an object of a dynamically generated class. Java array


inherits the Object class, and implements the Serializable as well as
Cloneable interfaces. We can store primitive values or objects in an
array in Java. Like C/C++, we can also create single dimensional or
multidimensional arrays in Java.

Example:

25
26

DATA TYPES:
Datatype is a special keyword used to allocate sufficient memory
space for the data, in other words datatype is used for representing the
data in main memory (RAM) of the computer.

In general every programming language is containing three categories


of data types. They are:

26
27

 Fundamental or primitive data types


 Derived data types
 User defined data types

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.

OPERATORS AND ITS TYPES:


Operator is a special symbol that tells the compiler to perform specific
mathematical or logical operation. Java supports following lists of
operators.

 Arithmetic Operators
 Relational Operators
 Logical Operators
 Bitwise Operators
 Assignment Operators
 Ternary or Conditional Operators

27
28

CONCLUSION:
Java is an object-oriented programming language. It is a general-
purpose programming language, mainly designed to run developed
java code on all platforms that support Java without recompilation.

As we all know, Java is one of the most popular and in-demand


programming languages to learn and it was one of the first languages
to standardise high-level threading utilities.

Java project is a must for aspiring developers. This project helps


developers develop real-world projects to hone their skills and
materialise their theoretical knowledge into practical experience. Java
has significant advantages both as a commercial language and also as
a teaching language. Java project provides rigorous compile-time
error checking typically associated with Pascal, allowing instructors
to introduce students to GUI programming, networking, threads, and
other important concepts used in modern-day software. Overall, the
java project gives a complete design for the extended language.

28
29

29
30

30

You might also like