SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
i
FIRST YEAR PRACTICAL TRAINING SEMINAR REPORT
CORE JAVA
Submitted in partial fulfilment of the degree of Bachelor of Technology
Rajasthan Technical University
By
Sudhanshu
Vijay
(PIET18CS139)
DEPARTMENT OF COMPUTER ENGINEERING
POORNIMA INSTITUTE OF ENGINEERING & TECHNOLOGY, JAIPUR
(Academic Year 2019-20)
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
ii
CERTIFICATE
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
3
DECLARATION
I hereby declare that the seminar report entitled “CORE JAVA" was carried out and
written by me under the guidance of Mr. Ashu Sharma and Dr. Rakhi Mutha, Assistant
Professor, Department of Computer Engineering, Poornima Institute of Engineering &
Technology, Jaipur. This work has not been previously formed the basis for the award
of any degree or diploma or certificate nor has been submitted elsewhere for the
award of any degree or diploma.
Place: JAIPUR Sudhanshu Vijay
Date: 15/07/2019 PIET18CS139
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
4
Acknowledgement
The completion of this training work could have been possible with continued & dedicated efforts & guidance
of large number of faculty & staff members of the institute .I acknowledge our gratitude to all of them.
The acknowledgement however will be incomplete without specific mention as follows I wish to
acknowledge my deep gratitude to ER. Abhishek Jain teacher and MD at Road Ahead Technologies (I) Pvt.
Ltd. Jaipur for his cooperation and guidance.
I would also like to acknowledge with much appreciation the crucial role of our HOD CSE department Mr.
Deepak Maud for this encouragement & providing all the facilities in the department. Finally, I would like
to say that I am indebted to my parents for everything that they have done for me. All of this would have been
impossible without their constant support. And I also thanks to God for being kind to me and driving me
through this journey.
Sudhanshu Vijay
PIET18CS139
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
5
ABSTRACT
As part of curriculum, and for the partial fulfilment of the requirements for completion of I year B.TECH.
from Poornima Institute Of Engineering And Technology, Jaipur. I Sudhanshu Vijay an software training of
CORE JAVA at Road Ahead Technologies, Jaipur for 45 days from 06-June-2019 to 21-July-2019. The report
consist of brief study and description of Core Java. The report contains detail of training in institute. All the
contents are broadly explained and it is constructed from the practical basis. In the content I have explained
my overall training familiarity in the last successive months. This content is the main content that I have
recorded and it contains overall work I have been executing.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
6
INDEX
S. No TOPIC NAME
PAGE NO.
1 Company Profile 7
2 Introduction To Java 8
3 The Java Platform 9
4 Installation Of Java 10
5 Configuring Variable 11
6 Write, Compile And Run A Java Program 13
7 Comparison Between C, C++ And Java 15
8 Java Basic Terms(Packages, Class And Object) 16
9 Inheritance 18
10 Variable And Method 19
11 Method And Constructor Overloading 21
12 Selection Statements 23
13 Modifiers And Import Statement 25
14 Interface 26
15 IDE 27
16 History of Java 28
17 Java Advantages and Disadvantages 31
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
7
18 Reference 33
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
8
COMPANY PROFILES
Road Ahead Technologies (I) Pvt. Ltd. incorporated in 2004 is an ISO 9001:2008 certified organization that
operates through well-defined systems and procedures. We have been relentlessly endeavouring to provide
end to end solutions to the Information Technology Industry with our expertise developed through the
profound experience we continue contributing in training, consulting and Software Development Services all
over Rajasthan.
It provides information and resources on IT education, training, development and services for everyone
involved in the sector - from students to educators and employers to employees. RAT through its strategic
alliances with global leaders like Oracle formulates the link between individuals and agencies with IT skills,
opportunities, and solutions.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
9
INTRODUCTION TO JAVA
With the invention of microprocessors, the world is scientificallydeveloped with sophisticated equipment,
systems, and devices. Microprocessors are used in computers, televisions, and fax machines. Even the
hand-held devices such as pagers, PDAs (Personal Digital Assistant), and cell phones make use
of microprocessors. All these electronic devices are helpful because of their communication
capabilities. With the increasing capabilities and decreasing cost of information processing and
networking technologies, the network is growing rapidly fortransmittinginformation throughelectronic
systems.
Internet is the network of networks between different types of computers located at different
places to transmit information. Information can reach to any place in the world quicklyat a cheaper
rate through the Internet. Thus, the Internet has made the world a global village for information exchange.
The emerging infrastructure of electronic devices and interconnected computer networks create an
environment that presents new challenges to software industries. For this emerging computing
environment, Java process to b e a well – suited programming language. it is found suitable for
networked environments involving a great variety of computer and devices.
Java has many characteristics that have contributed to its popularity:
 Platform independence - Many languages are compatible with only one platform. Java
was specificallydesigned so that it would run on any computer, regardless if it was running
Windows, Linux,Mac, Unix or any of the other operating systems.
 Simple and easy to use - Java's creators tried to design it so code could be written
efficiently and easily.
 Multi-functional - Java can produce many applications from command-line programs to
applets to Swing windows (basically, sophisticated graphical user interfaces).
Java does have some drawbacks. Since it has automated garbage collection, it can tend to use more
memory than other similar languages. There are often implementation differences on different
platforms, which have led to Java being described as a "write once, test everywhere" system. Lastly,
since it uses an abstract "virtual machine", a generic Java program doesn't have access to the Native
API's on a system directly. None of these issues are fatal, but it can mean that Java isn't an
appropriate choice for a particular piece ofsoftware.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
10
THE JAVA PLATFORM
One thingthat distinguished Java from some other languages is its ability to run the same compiled code across
multipleoperating systems. In other languages,thesource code (code that iswrittenby theprogrammer), iscompiled
by a compiler into an executable file. This file is in machine language, and is intended for a single operating
system/processor combination, so the programmer would have to re-compile the program separately for each new
operating system/processor combination. Java is different in that it does not compile the code directly into machine
language code. Compilation creates bytecode out of the source code. Bytecode generally looks something
like this:
a7 f4 73 5a 1b 92 7d
When the code is run by the user, it is processed by something called the Java Virtual Machine (JVM).
The JVM is essentially an interpreter for the bytecode. It goes through the bytecode and runs it. There
are different versions of the JVM that are compatible with each OS and can run the same code. There
is virtually no difference for the end-user, but this makes it a lot easier for programmers doing software
development.
Java and Open Source:-
 In 2006 Sun started to make Java available under the GNU General Public License (GPL).
Oracle continues this project called OpenJDK.
Java Virtual machine :-
 The Java virtual machine (JVM) is a software implementation of a computer that executes
programs like a real machine.
 The Java virtual machineis written specifically for a specific operating system, e.g. for Linux
a special implementation is required as well as forWindows.
 Java programs are compiled by the Java compiler into bytecode. The Java virtual machine
interprets this bytecode and executes the Java program.
Java Runtime Environment vs. Java Development Kit
 A Java distribution comes typicallyin two flavors, the Java Runtime Environment (JRE) and
the Java Development Kit (JDK).
 The Java runtimeenvironment (JRE) consists of the JVM and the Java class libraries and contains
the necessary functionality to start Javaprograms.
 The JDK contains inaddition the development tools necessary to create Java programs. The
JDK consists therefore of a Java compiler, the Java virtual machine, and the Java class
libraries.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
11
INSTALLATION OF JAVA
Checking Installation
 Java mightalready be installed on your machine. You can test this by opening a console (if
you are using Windows: Win+R, enter cmd and press Enter) and by typing in the following
command:
 java -version
 If Java is correctly installed, you should see some information about your Java installation.
If the command line returns the information that the program could not be found, you have
to install Java.
Installing the Java Development Kit
 Before installingthe Java Development Kit (JDK), you should probably know what it is. It
is distributed by Oracle. It contains the core libraries and compiler required to develop Java.
The JDK should not be confused with the JRE (Java Runtime Environment). The JRE is a
JVM for running, as opposed to compiling, Javaprograms.
Downloading and Installing
To download the JDK go to
http://www.oracle.com/technetwork/java/javase/downloads/index.html Click on "JDK
with NetBeans Bundle". Follow the instructions for downloading the JDK installationfile.
Windows: If you are runningWindows, simplyrun the executable fileand followthe installation
instructions.
Unix, Solaris, or Linux: For Linuxand Unix,download the "jdk1 6.0" for Linuxsystems.
Save the downloaded file in any drive. Once you have saved the file, extract it to a place
that you can remember, by using Terminal or by double clicking on the file. When you
have finishedextracting the file,copy the JDK 1.6.0 folder and paste it inthe usr/local(To paste to
the usr/local directory, you have to be in root) so that every user can use the java files. You
can delete the downloaded zip file so that it doesn't take up space on your drive.
Macintosh: The latest available JDK is automatically installed by the operating system.
Because Java for Macintosh is developed and maintained by Apple, in coordination with
Sun, the current version on the Macintosh may not be the current version that is available
Note on Editions
 The JDK comes inthree editions.
 Java Standard Edition (JSE) – This version is the basic platform for Java. The course will
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
12
focus on this edition.
 Java Enterprise Edition (JEE) – This edition is mainly for developing and running distributed
multitier architecture Java applications, based largely on modular software components running
on an application server. We willnot be covering this version in the course.
 Java Micro Edition (JME) – This edition is primarilyfor developing programs to run on
consumer applicances, such as PDAs and cellphones.
CONFIGURING VARIABLES
 Before writingcode, it is recommended that you set the Path variable on your system so
you can compile your code more easily.
For Windows Users
 From the Control Panel, double click "System" (System and Maintenance in Vista)
 For Windows Vista, 7, 8 and 10 click on "System," "Advanced System Settings" on the left,
and then on "Environment Variables."
 For XP and 2000, click on the "Advanced" tab and click on "Environment Variables" For
NT, click on the "Environment" tab.
 Select the Path variable and click "Edit"
 Add the path to the bin directory of where Java is installed on your hard drive. It should probably
be: C:Program FilesJavajdk1.6.0_20bin unless you changed it during installation.
 Click OK
For Linux and UNIX
 One way to set your path in Linux/Unix is to add a path export to your bash profile.
 In order to do this, first open your bash profile ina text editor. For example,
 pico ~/.bash_profile
 Then add this line:
 export PATH=$PATH:/usr/local/jdk/bin
 Note that the path to the java directory "/usr/local/jdk/bin" may be different on your
machine.
 Restart your shell.
 For Macintosh
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
13
 Apple sets everything up for you. Sit back andrelax.
 The onlydrawback is that because Apple handles development and maintenance of Java on
the Mac, there isusuallya delay from the time that a new version is released by Sun and the
timethatthenewversionisreleased on theMac. Also,gettingthelatestversionsometimesrequires
an operating system upgrade.
 Oh well, you can't have everything.
Validate installation
 Switch again to the command lineand run the following command.
 java -version
 The output should be similarto the following output.
 java version "1.7.0_25"
 OpenJDK RuntimeEnvironment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.13.04.2)
 OpenJDK 64-Bit Server VM (build 23.7-b01, mixedmode)
Development Process with Java
 Java source files are written as plain text documents. The programmer typically writes Java
source code in an Integrated Development Environment (IDE) for programming. An IDE
supports the programmer in the task of writing code, e.g. it provides auto-formatting of the
source code, highlighting of the important keywords, etc.
 At some point the programmer (or the IDE) calls the Java compiler (javac). The Java compiler
creates the bytecode instructions. These instructions are stored in .class files and can be
executed by the Java Virtual Machine.
Garbage collector
 The JVM automaticallyre-collects the memory which is not referred to by other objects. The
java garbage collector checks all object references and find the objects which can be
automatically released.
 Whilethe garbage collector releases the programmer from the need to explicitly manage memory
theprogrammerstillneed to ensurethathedoes not keep unneeded object references otherwise
the garbage collector cannot release the associated memory. Keeping unneeded object
references are typically called memory leaks.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
14
Class path
 The class path defines where the Java compiler and Java runtime look for .class files to load.
This instructions can be used inthe Java program.
 For example if you want to use an external Java library you have to add this library to your
class path to use it in your program.
WRITE, COMPILE AND RUN A JAVA PROGRAMME
 Write source code
 ThefollowingJava program is developed under Windows10 using a Notepad++.Theprocess
on other operating system should be similar and but is not covered in this description.
 Select or create a new directory which will be used for your Java development. On Microsoft
Windows your mightwant to use c:tempjavastarter. Thispath iscalled javadir inthe following
description. Open a text editor which supports plain text, e.g. gedit under Linux or
Notepad++ under Windows and write the followingsource code.
Save the source code in your javadir directory with the Hello.java filename. The name of a
Java source file must always equals the class name (within the source code) and end with
the .java extension. In this example the filename must be Hello.java because the
class is called Hello.
Compile and run your Java program
 In Windows java programs can either be compile using the console block of Notepad++ or
using CMD.
 In both cases keywords used for compilation and running be same.
 The difference is in the method of opening the window for console and cmd.
 Both the methods can be opened using Notepad++.
 For compiling javac filename.java is used.
 For compilation of this file we use javac Hello.java.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
15
 After compilation to execute the program we use java filename.
 For this file we use java Hello is used
 Compilation can be done using class name but can be run only by using file name.




First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
16
COMPAIRISION BETWEEN C, C++ AND JAVA
Java v/s C
The difference between C and Java are as follows:
C Language Java Language
C is function oriented language. Java is an object oriented language.
Basic programming unit is function. Basic programming unit is class.
Compiled code is not portable; recompilation is
required for each architecture.
Compiled code is portable, Bytecode is Written
once and run everywhere.
Data types and there memory storage:
Int-2 bytes;long-4bytes;char-1 byte
Data types and there memory storage:
Int-4 bytes;long-8bytes;char-2 byte
It also have byte, short, Boolean data types.
It follows ASCII code. It follows UNICODE.
Variables must be declared at the beginning of the
block.
Variables can be declared anywhere before its first
use.
There are pointers in C. Java does not supports pointers.
Supports function overloading, operator
overloading.
Supports function overloading only.
Supports both narrowing(higher datatype to lower)
and widening(lower datatype to higher).
Supports widening for narrowing explicit
typecasting is required.
Does not support automatic garbage collection. Supports automatic garbage collection.
No exception handling mechanism. Supports exception handling.
C support the struct, union and pointer datatypes.
Java does not support struct, union and pointer
datatypes.
Java v/s C++
The difference between C++ and Java are as follows:
C++ Java
C++ supports the struct, union and pointer data
types.
Java does not support struct, union and pointer
datatypes.
C++ supports typedef or #define. Java does not supports typedef or #define.
C++ permits operator overloading. Java does not permits operator overloading.
C++ supports multiple inheritance, hence virtual
functions.
Java does not supports multiple inheritance, so no
virtual functions are there.
Command Line Arguments are not handled like
java.
Java handles Command Line Arguments differently
than C or C++.
Null-terminated array of characters are used in C
and C++.
Java has string class as part of the java.lang
package.
Use memory allocation and de-allocation functions.
Java has an automatic system for allocation and
freezing memory (Garbage collection).
Destructor are there in C++. No destructors in java.
C++ refers on non-standard third party libraries.
Java contains standard libraries for solving specific
tasks.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
17
JAVA BASIC TERMS
Basics: Package, Class and Object
It is important to understand the base terminology of Java interms of packages, classes and
objects. This section gives an overview of these terms.
Packages
Java groups classes into functional packages.
Packages are typically used to group classes intological units. For example all graphical
views of an application mightbe placed in the same package called
com.vogella.webapplication.views.
It is common practice to use the reverse domain name of the company as top level package. For
examplethe company mightown the domain,vogella.com and inthisexampletheJava packages of
this company starts withcom.vogella.
Other main reason for the usage of packages is to avoid name collisions of classes. A name
collision occurs if two programmers give the same fully qualified name to a class. The fully
qualified name of a class inJava consists out of the package name followed by a dot (.) and the
class name.
Without packages, a programmer may create a Java class called Test. Another programmer
may create a class with the same name. With the usage of packages you can tell the system
which class to call. For example ifthe first programmer puts the Test class into package report
and the second programmer puts his class into package xmlreader you can distinguish
between these classes by usingthe fully qualified name, e.g. xmlreader.Test or report. Test.
 Class
Def.: Template that describes the data and behavior associated with an instance of that
class.
In Java source code a class is defined by the class keyword and must start with a capital
letter. The body of a class is surrounded by {}.
The data associated with a class is stored in variables ; the behavior associated to a class
or object is implemented with methods.
A class is contained in a Java source file with the same name as the class plus the .java extension.
 Object
Def.: An object is an instance of a class.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
18
The object is the real element which has data and can perform actions. Each object is
created based on the class definition.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
19
INHERITANCE
A class can be derived from another class. In this case this class is called a subclass. Another
common phrase is that a class extends another class.
The class from which the subclass is derived is called a superclass.
Inheritance allows a class to inherit the behavior and data definitions of another class.
The following codes demonstrates how a class can extend another class. In Java a class can
extend a maximum of one class.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
20
VARIABLES AND METHODS
 Variable
Variables allow the Java program to store values during the runtime of the program.
A variable can either be a primitive variable or a reference variable. A primitive variable contains
value while the reference variable contains a reference (pointer) to the object.
Hence if you compare two reference variables, you compare if both point to the same object. To
compare objects use the object1.equals(object2) method call.
 Instance variable
Instance variable is associated with an instance of the class (also called object). Access works
over these objects.
Instance variables can have any access control and can be marked final or transient. Instance
variables marked as final can not be changed after assigned to a value.
 Local variable
Local (stack) variable declarations cannot have access modifiers.
final is the only modifier available to local variables. This modifier defines that the variable can
not be changed after first assignment.
Local variables do not get default values, so they must be initialized before use.
 Methods
A method is a block of code with parameters and a return value. It can be called on the object.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
21
Method can be declared with var-args. In this case the method declares a parameter which
accepts from zero to many arguments (syntax: type .. name;) A method can only have one
var-args parameter and this must be the last parameter in the method.
Overwrite of a superclass method: A method must be of the exact same return parameter and the same
arguments. Also the return parameter must be the same. Overload methods: An overloaded method is
a method with the same name, but different arguments. The return type can not be used to overload a
method
 Constructor
A class contains constructors that are invoked to create objects based on the class definition.
Constructor declarations look like method declarations except that they use the name of the
class and have no return type. A class can have several constructors with different parameters.
Each class must define at least one constructor.
Following is a simple example the constructor.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
22
METHOD AND CONSTRUCTOR OVERLOADING
 Method overloading
Method Overloading is a feature that allows a class to have more than one method having the same name, if
their argument lists are different. It is similar to constructor overloading in Java that allows a class to have
more than one constructor having different argument lists.
To understand method overloading following programme can be use:
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
23
 Constructor overloading
Like methods, constructors can also be overloaded.
Constructor overloading is a concept of having more than one constructor with different
parameters list, in such a way so that each constructor performs a different task.
Following programme explains constructor overloading:
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
24
SELECTION STATEMENTS
Java supports two selection statements: if and switch. These statements allow you to control the flow of
your programme’s execution based upon certain conditions during runtime.
1. if statement
a) Simple if
b) Simple if else
c) Nested if
d) Nested if else
2. switch statement
if Statement
This if statement is used if we wish to execute a statement if a condition is true. If statement has many forms
and is very powerful in dealing with statements where we want to do selection based on condition.
Flow Chart:- Simple if else
Flow Chart:- Nested if else
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
25
Flow Chart:- if else ladder
switch-case statement
The value in parentheses just after the switch keyword is called the expression of the switch statement, and
it must be of type byte, short, char, or int. When the switch code is executed, Java searches through the
case statements, looking for one that matches the expression's value.
[1.]If no match is found, default block is executed if it is present, default is an optional block else execution
continues after the closing curly bracket.
[2.]If a match is found, control jumps to the first executable line following the case statement. Then execution
proceeds line by line until a break statement is reached. At this point, execution of the switch code is
terminated, and control continues after the closing curly bracket.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
26
MODIFIERS
 Access modifiers
There are three access modifiers keywords available in Java. public, protected and private. There
are four access levels: public, protected, default and private. They define how the corresponding
element is visible to other components. If something is declared public, e.g. classes or methods
can be freely created or called by other Java objects. If something is declared private, e.g. a
method, it can only be accessed within the class in which it is declared. protected and default are
similar. A protected class can be accessed from the package and sub-classes outside the package
while a default class can get only accessed via the same package. The following table describes
the visibility:
Table 1. Access Level
Modifier Class Package Subclass World
Public Y Y Y Y
protected Y Y Y N
Modifier Class Package Subclass World
no
modifier
Y Y N N
Private Y N N N
Other modifiers
 final methods: cannot be overwritten in a subclass
 abstract method: no method body
 synchronized method: threat safe, can be final and have any access control
 native methods: platform dependent code, apply only to methods  strictfp: class or
method
Import statements
 Usage of import statements
In Java you have to access a class always via its full-qualified name, e.g. the package name
and the class name. You can add import statements for classes or packages into your class
file, which allow you to use the related classes in your code without the package qualifier.
 Static imports
Static import is a feature that allows members (fields and methods) which are defined in a
class with the public static access modifier to be used in Java code without specifying the class
in which the member is defined. The feature provides a type safe mechanism to include
constants into code without having to reference the class that originally defined the field.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
27
INTERFACE
Interfaces are contracts for what a class can do but they say nothing about the way in which
the class must do it. An interface is a type similar to a class. Like a class an interface defines
methods. An interface can have only abstract methods, no concrete methods are allowed.
Methods defined in interfaces are by default public and abstract – explicit declaration of these
modifiers is optional. Interfaces can have constants which are always implicitly public, static
and final. A class can implement an interface. In this case it must provide concrete
implementations of the interface methods. If you override a method defined by an interface
you can also use the @override annotation.
 Abstract class and methods
A class and method can be declared as abstract. An abstract class can not be directly
instantiated. If a class has at least one method which only contain the declaration of the method
but not the implementation then this class is abstract and can not be instantiated. Sub-classes
need then to define the methods except if they are also declared as abstract. If a class contains
an abstract method it also needs to get defined with the keyword abstract. The following
example shows an abstract class.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
28
INTEGRATED DEVLOPMENT ENVIORNMENT
The previous chapter explained how to create and compile a Java program on the command line. A
Java Integrated Development Environment (IDE) provides lots of ease of use functionality for
creating java programs. There are other very powerful IDE's available, for example the Eclipse IDE.
. For an introduction on how to use the Eclipse IDE please see Eclipse IDE Tutorial. The remaining
description uses the phrase: Create a Java project called... ". This refers to creating a Java project in
Eclipse. If you are using a different IDE please follow the required steps in this IDE. Exercises -
Creating Java objects and methods Create a Person class and instantiate it Create a new Java project
called com.vogella.javastarter.exercises1 and a package with the same name. Create a class called
Person. Add three instance variables to it, one for storing the first name of the person, on for storing
the last name and one for storing the age of the Person. Use the constructor of the Person object to set
the values to some default value. Write a public method called writeName() which uses the
System.out.println( method to print the first name of the person to the console. Create a new class
called Main with a public static void main(String[] args). In this method create an instance of the
Person class.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
29
HISTORY OF JAVA
It is quite interesting to know the development of Java technology, which is widely accepted
in the area of networked/distributed computing. Java evolved from a project developing a
language for programming consumer electronic devices at Sun Microsystems, USA.
Sun’s Stealth Project in 1990 was aimed to do research in the area of application of computers
in the consumer electronics market. Bill Joy, James Gosling, Mike Sheridan, Patrick
Naughton (formerly the project leader of Sun’s Open Windows user environment), and
several other individuals discussed the ideas for the Stealth Project in January 1991.The vision
of this project was to develop smart consumer electronic devices that could all be centrally
controlled and programmed from a handheld-remote-control-like device. The Stealth group
began to work to achieve this goal. It was realized that a platform-independent development-
environment was needed.
Green Project was initiated by Patrick Naughton, Mike Sheridan, and James Gosling of Sun
Microsystems in 1991 (Members of the Stealth Project, which later became known as the
Green Project) The tasks of the project were divided amongst the members of Green Project.
Mike Sheridan concentrated on business development, Patrick Naughton worked on the
graphics system, and James Gosling was to identify the appropriate programming language
for the Green Project. Even though creating a new language was not the aim of Green Project,
a new language was created as a programming tool in this project since C++ was found
unsuitable for the project.
An intelligent remote control called *7 (Star Seven) was delivered as the first product of
Green Project in 1992. It is a PDA- like device comprising of a new language oak, an operating
system called GreenOS, user interface, and hardware. This device was quite impressive to
Sun Executives. But no customer was interested in this project. The market was not conducive
to this type of device in the consumer electronics industry.
The new language Oak was created by James Gosling, a Green Team member, specifically
for *7. Gosling named the new language Oak because that name was struck while looking at
an oak three outside of his office window. The name Oak was later renamed to Java in order
to avoid legal issues since Oak was the name of an existing language.
In November 1992, the Green Project was incorporated under the name FirstPerson. In 1993.
Time-Warner was demanding for proposals for set-top box operating systems and videoon-
demand technology with an objective of sending the data to consumer all over the country for
display on the television sets. At the same time (1993(, NCSA released the first graphical web
browser Mosaic 1.0, an easy-to-use front end to the World Wide Web.
When FirstPerson was bidding on the Time-Warner TV trial based on video-on-demand
technology, Time-Warner chose Silicon Graphics, Inc. (SGI) over Sun. Hence, half of the
members of FirstPerson left for SGI and the remaining members continued to work at Sun.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
30
Mosaic web browser revolutionized people’s perceptions. The remaining member of
FirstPerson returned to work on Java (Oak was renamed Java) to develop Java-based web
browser. FirstPerson was dissolved gradually. Naughton and Jonathan Payne developed
WebRunner (named after the movie Blade Runner). Later WevRunner was officially
announced as the HotJavaTM
browser in 1994. This was the turning point for Java. At that
time the World Wide Web changed the face of Internet and it was winning the race on Internet.
Arthur Ban Hoff implemented the Java compiler in Java itself whereas Gosling implemented
it in C. The Java compiler, written in Java made the people to accept Java as a fullfeatured
language.
Sun Microsystems officially announced Java environment at Sun World’95 on May
23, 1995. Java entered into the mainstream of the Internet after a struggle for about four years.
Netscape Communications incorporated Java into its web browser Netscape Navigator.
Within a decade, Java was destined to be the most overreaching technology in the Internet.
Java was not restricted to the Internet alone. The initial goal of Sun was also achieved by using
Java technology in interactive set-top boxes, hand-held devices and other consumer
electronics products.
Sun released the first version 1.0 of Java in 1996. Java is an object-oriented
programming language which evolved from C++. It is also a high-level programming
language. The different forms of Java versions are discussed in the next section.
History of JAVA
Year Java - Versions and Features
1990 Sun Microsystems started Stealth project supporting application of computers
in the consumer electronics market.
1991 The Green project started with the members of Stealth project such as James
Gosling, Patrick Naughton, and Mike Sheridan. A new programming language,
called Oak was created by Gosling.
1992 An intelligent remote control called StarSeven was delivered. The Green Project
was incorporated was incorporated under the name FirstPerson.
1993 Mosaic Web browser was introduced in the world of Internet.
1994 HotJava Web browser was announced by Sun Microsystems.
1995 Oak was renamed as Java. Sun officially announced Java technology.
1996 Sun released the first version 1.0 of Java. Core Language features supporting:
I/O
facility, Utilities, Network Programming, User Interface – AWT, Applets, and
Multithreading.
1997 Sun released JDK1.1 by including new features such as addition of inner classes
to the language and capabilities such as JavaBeans, JDBC(Java Data Base
Connectivity), and RMI (Remote Method Invocation).
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
31
1998 Java 2 Platform, Standard Edition (J2SE)1.2, code named as Playground, was
released. It replaced JDK and distinguished the base platform from j2ee (Java 2
Platform, Enterprise Edition) and J2ME (Java 2Platform, Micro Edition). The
key features include Swing graphical API, Java IDL (Interface Definition
Language) to support CORBA interoperability. They also added Collections
framework to support various data structures. For the first time, JVM was
equipped with a JIT (Just-in Time) compiler.
2000 J2SE 1.3, code named as Kestrel, was released with key features such as Java
Sound API to support audio operations (e.g., audio playback and
capture/recording, mixing, sequencing, and synthesis), Java Naming and
Directory Interface (JNDI), and Java Platform Debugger Architecture (JPDA).
2002 H2SE 1.4, code named as Merlin, was released with key features such as (a)
image I/O API for manipulating images in formats like JPEG and PNG, (b)
integrated XML parser and XSLT processor (JAXP), integrated security and
cryptography extensions, (c) Java Web Start supporting deployment of Java
software applications over the network.
2004 J2SE 5.0, code named as Tiger, was released with enhancement of Java platform
and inclusion of a number of significant new language features such as Generics,
Enhanced for Loop, Autoboxing/Unboxing, Typesafe Enums, Varags, Static
Import, and Metadata supporting declarative style programming annotation of
source code.
2006 Java SE 6.0, code named as Mustang, was released with enhancement of
performance in Swing, JDBC 4.0 support, Java Compiler API, Upgrade of
JAXB to version 2.0, including integration of a StAX parser, support for
pluggable annotations, and many GUI improvements.
2008 Java SE 7.0, code named as Dolphin, with native support for XML recognizing
its foundation for Web services.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
32
JAVA ADVANTAGES AND DISADVANTAGES
Java is a general-purpose, high-level programming language initially designed for handheld devices
and set-top boxes. Java was repurposed in 1995 to create applications on the World Wide Web.
Today, Java is commonly used for creating web and mobile applications.
There are several advantages and disadvantages of using Java that have been listed below.
Advantages
Simple: Java was designed to be easy to use, write, compile, debug, and learn than other
programming languages. Java is much simpler than C++ because Java uses automatic memory
allocation and garbage collection.
Object-Oriented: Object oriented programming is associated with concepts like class, object,
inheritance, encapsulation, abstraction, polymorphism, etc. which allows you to create modular
programs and reusable code. You can declare classes, create objects inside classes, and interact
between two objects.
Platform-Independent: Java offers the comfort of write program once and run on any hardware
and software platform and any Java compatible browser. This gives the ability to move easily from
one computer system to another.
Distributed: Java has great networking capability, it is designed to make distributed computing
easy with the networking capability that is inherently integrated into it.
Secure: Java is the first programming language to include security an integral part of the design.
Java’s compiler, interpreter, and runtime environment were each developed with security in mind.
Java Virtual Machine has a unique identifier that identifies the bytecode and verifies it before running
it.
Allocation: Java has the feature of Stack allocation system. It follows LIFO (Last in First Out) which
helps the data to be stored and retrieved easily.
Multithreaded: Java is one of the programming languages to support Multithreading.
Multithreading is the capability for a program to perform several tasks simultaneously within a
program.
Rich APIs: Java offers various APIs for application development. Java APIs (Application
Programming Interface) is the set of commands or methods of communication among various
activities like Database connection, networking, I/O, XML parsing, utilities, and much more.
Powerful Open source Rapid Development Tools: Over the year’s several open source
development tools i.e., IDEs such as Eclipse and Netbeans, have been created with Java as a base
which makes Java more powerful for application development. IDEs makes application development
simpler with powerful coding and debugging features.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
33
Robust: Java is one of the most robust programming languages, that is Java is more reliable. Java
compilers can detect any errors in the coding. There are also other features like exception handling
and garbage collection which makes Java more robust.
Resource Availability: There are tons of online java training courses available to learn java. You
don’t have to spend a fortune to learn java programming.
Disadvantages
Performance: Significantly slower and more memory-consuming than natively compiled languages
such as C or C++.
Look and feel: The default look and feel of GUI applications written in Java using the Swing toolkit
is very different from native applications.
Single-paradigm language: The addition of static imports in Java 5.0 the procedural paradigm is
better accommodated than in earlier versions of Java.
First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur
34
REFERENCE
[1.]www.udemy.com
[2.]Programming in JAVA (Student Learning Booklet of Road Ahead Technology)
[3.]https://www.mindsmapped.com/java-advantages-and-disadvantages/

Mais conteúdo relacionado

Mais procurados

Summer training presentation on "CORE JAVA".
Summer training presentation on "CORE JAVA".Summer training presentation on "CORE JAVA".
Summer training presentation on "CORE JAVA".SudhanshuVijay3
 
Introduction to Basic Java Versions and their features
Introduction to Basic Java Versions and their featuresIntroduction to Basic Java Versions and their features
Introduction to Basic Java Versions and their featuresAkash Badone
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaSaba Ameer
 
Core Java
Core JavaCore Java
Core JavaNA
 
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core javamahir jain
 
Genesis and Overview of Java
Genesis and Overview of Java Genesis and Overview of Java
Genesis and Overview of Java Ravi_Kant_Sahu
 
Core java report
Core java reportCore java report
Core java reportSumit Jain
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java ProgrammingRavi Kant Sahu
 
Java Presentation
Java PresentationJava Presentation
Java Presentationaitrichtech
 
Industrial Training Seminar PPT
Industrial Training Seminar PPTIndustrial Training Seminar PPT
Industrial Training Seminar PPTFaiz Ahmad Khan
 
android app development training report
android app development training reportandroid app development training report
android app development training reportRishita Jaggi
 
Android Internship report presentation
Android Internship report presentationAndroid Internship report presentation
Android Internship report presentationvinayh.vaghamshi _
 
JRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAJRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAMehak Tawakley
 

Mais procurados (20)

Core java
Core java Core java
Core java
 
Summer training presentation on "CORE JAVA".
Summer training presentation on "CORE JAVA".Summer training presentation on "CORE JAVA".
Summer training presentation on "CORE JAVA".
 
Core java slides
Core java slidesCore java slides
Core java slides
 
Introduction to Basic Java Versions and their features
Introduction to Basic Java Versions and their featuresIntroduction to Basic Java Versions and their features
Introduction to Basic Java Versions and their features
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
core java
core javacore java
core java
 
Core Java
Core JavaCore Java
Core Java
 
Java
JavaJava
Java
 
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core java
 
Genesis and Overview of Java
Genesis and Overview of Java Genesis and Overview of Java
Genesis and Overview of Java
 
Core java report
Core java reportCore java report
Core java report
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
 
Industrial Training Seminar PPT
Industrial Training Seminar PPTIndustrial Training Seminar PPT
Industrial Training Seminar PPT
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
 
Features of java
Features of javaFeatures of java
Features of java
 
android app development training report
android app development training reportandroid app development training report
android app development training report
 
Introduction of java
Introduction  of javaIntroduction  of java
Introduction of java
 
Android Internship report presentation
Android Internship report presentationAndroid Internship report presentation
Android Internship report presentation
 
JRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAJRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVA
 

Semelhante a Report summer training core java

Neel training report
Neel training reportNeel training report
Neel training reportNeel Chandra
 
Industrial training report on core java
Industrial training report on core java Industrial training report on core java
Industrial training report on core java Nitesh Dubey
 
IRJET- Online Compiler for Computer Languages with Security Editor
IRJET-  	  Online Compiler for Computer Languages with Security EditorIRJET-  	  Online Compiler for Computer Languages with Security Editor
IRJET- Online Compiler for Computer Languages with Security EditorIRJET Journal
 
Review Paper on Online Java Compiler
Review Paper on Online Java CompilerReview Paper on Online Java Compiler
Review Paper on Online Java CompilerIRJET Journal
 
Java Course in Gurgaon: Your Gateway to Mastering Java Programming
Java Course in Gurgaon: Your Gateway to Mastering Java ProgrammingJava Course in Gurgaon: Your Gateway to Mastering Java Programming
Java Course in Gurgaon: Your Gateway to Mastering Java ProgrammingUncodemy
 
IRJET - V-IDE: Voice Controlled IDE using Natural Language Processing and...
IRJET -  	  V-IDE: Voice Controlled IDE using Natural Language Processing and...IRJET -  	  V-IDE: Voice Controlled IDE using Natural Language Processing and...
IRJET - V-IDE: Voice Controlled IDE using Natural Language Processing and...IRJET Journal
 
Vikeshp
VikeshpVikeshp
VikeshpMdAsu1
 
Java report by ravi raja
Java report by ravi rajaJava report by ravi raja
Java report by ravi rajaRaviRaja55
 
A Review of Virtual Programming Laboratory: Design Issues
A Review of Virtual Programming Laboratory: Design IssuesA Review of Virtual Programming Laboratory: Design Issues
A Review of Virtual Programming Laboratory: Design IssuesIRJET Journal
 
Portable Code Compiler
Portable Code CompilerPortable Code Compiler
Portable Code Compilerijtsrd
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javashwanjava
 
JAVA INTERNSHIP PROGRAM
JAVA INTERNSHIP PROGRAMJAVA INTERNSHIP PROGRAM
JAVA INTERNSHIP PROGRAMteju281
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Pratima Parida
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Pratima Parida
 
IRJET- Online Programming Environment
IRJET- Online Programming EnvironmentIRJET- Online Programming Environment
IRJET- Online Programming EnvironmentIRJET Journal
 

Semelhante a Report summer training core java (20)

Neel training report
Neel training reportNeel training report
Neel training report
 
Industrial training report on core java
Industrial training report on core java Industrial training report on core java
Industrial training report on core java
 
IRJET- Online Compiler for Computer Languages with Security Editor
IRJET-  	  Online Compiler for Computer Languages with Security EditorIRJET-  	  Online Compiler for Computer Languages with Security Editor
IRJET- Online Compiler for Computer Languages with Security Editor
 
Review Paper on Online Java Compiler
Review Paper on Online Java CompilerReview Paper on Online Java Compiler
Review Paper on Online Java Compiler
 
Java Course in Gurgaon: Your Gateway to Mastering Java Programming
Java Course in Gurgaon: Your Gateway to Mastering Java ProgrammingJava Course in Gurgaon: Your Gateway to Mastering Java Programming
Java Course in Gurgaon: Your Gateway to Mastering Java Programming
 
BIT211.pdf
BIT211.pdfBIT211.pdf
BIT211.pdf
 
IRJET - V-IDE: Voice Controlled IDE using Natural Language Processing and...
IRJET -  	  V-IDE: Voice Controlled IDE using Natural Language Processing and...IRJET -  	  V-IDE: Voice Controlled IDE using Natural Language Processing and...
IRJET - V-IDE: Voice Controlled IDE using Natural Language Processing and...
 
Vikeshp
VikeshpVikeshp
Vikeshp
 
Training report
Training reportTraining report
Training report
 
Java report by ravi raja
Java report by ravi rajaJava report by ravi raja
Java report by ravi raja
 
A Review of Virtual Programming Laboratory: Design Issues
A Review of Virtual Programming Laboratory: Design IssuesA Review of Virtual Programming Laboratory: Design Issues
A Review of Virtual Programming Laboratory: Design Issues
 
Portable Code Compiler
Portable Code CompilerPortable Code Compiler
Portable Code Compiler
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
gopal hp
gopal hpgopal hp
gopal hp
 
JAVA INTERNSHIP PROGRAM
JAVA INTERNSHIP PROGRAMJAVA INTERNSHIP PROGRAM
JAVA INTERNSHIP PROGRAM
 
JAVA TRAINING IN MOHALI
JAVA TRAINING IN MOHALIJAVA TRAINING IN MOHALI
JAVA TRAINING IN MOHALI
 
String class
String classString class
String class
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
IRJET- Online Programming Environment
IRJET- Online Programming EnvironmentIRJET- Online Programming Environment
IRJET- Online Programming Environment
 

Último

DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 

Último (20)

DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 

Report summer training core java

  • 1. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur i FIRST YEAR PRACTICAL TRAINING SEMINAR REPORT CORE JAVA Submitted in partial fulfilment of the degree of Bachelor of Technology Rajasthan Technical University By Sudhanshu Vijay (PIET18CS139) DEPARTMENT OF COMPUTER ENGINEERING POORNIMA INSTITUTE OF ENGINEERING & TECHNOLOGY, JAIPUR (Academic Year 2019-20)
  • 2. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur ii CERTIFICATE
  • 3. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 3 DECLARATION I hereby declare that the seminar report entitled “CORE JAVA" was carried out and written by me under the guidance of Mr. Ashu Sharma and Dr. Rakhi Mutha, Assistant Professor, Department of Computer Engineering, Poornima Institute of Engineering & Technology, Jaipur. This work has not been previously formed the basis for the award of any degree or diploma or certificate nor has been submitted elsewhere for the award of any degree or diploma. Place: JAIPUR Sudhanshu Vijay Date: 15/07/2019 PIET18CS139
  • 4. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 4 Acknowledgement The completion of this training work could have been possible with continued & dedicated efforts & guidance of large number of faculty & staff members of the institute .I acknowledge our gratitude to all of them. The acknowledgement however will be incomplete without specific mention as follows I wish to acknowledge my deep gratitude to ER. Abhishek Jain teacher and MD at Road Ahead Technologies (I) Pvt. Ltd. Jaipur for his cooperation and guidance. I would also like to acknowledge with much appreciation the crucial role of our HOD CSE department Mr. Deepak Maud for this encouragement & providing all the facilities in the department. Finally, I would like to say that I am indebted to my parents for everything that they have done for me. All of this would have been impossible without their constant support. And I also thanks to God for being kind to me and driving me through this journey. Sudhanshu Vijay PIET18CS139
  • 5. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 5 ABSTRACT As part of curriculum, and for the partial fulfilment of the requirements for completion of I year B.TECH. from Poornima Institute Of Engineering And Technology, Jaipur. I Sudhanshu Vijay an software training of CORE JAVA at Road Ahead Technologies, Jaipur for 45 days from 06-June-2019 to 21-July-2019. The report consist of brief study and description of Core Java. The report contains detail of training in institute. All the contents are broadly explained and it is constructed from the practical basis. In the content I have explained my overall training familiarity in the last successive months. This content is the main content that I have recorded and it contains overall work I have been executing.
  • 6. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 6 INDEX S. No TOPIC NAME PAGE NO. 1 Company Profile 7 2 Introduction To Java 8 3 The Java Platform 9 4 Installation Of Java 10 5 Configuring Variable 11 6 Write, Compile And Run A Java Program 13 7 Comparison Between C, C++ And Java 15 8 Java Basic Terms(Packages, Class And Object) 16 9 Inheritance 18 10 Variable And Method 19 11 Method And Constructor Overloading 21 12 Selection Statements 23 13 Modifiers And Import Statement 25 14 Interface 26 15 IDE 27 16 History of Java 28 17 Java Advantages and Disadvantages 31
  • 7. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 7 18 Reference 33
  • 8. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 8 COMPANY PROFILES Road Ahead Technologies (I) Pvt. Ltd. incorporated in 2004 is an ISO 9001:2008 certified organization that operates through well-defined systems and procedures. We have been relentlessly endeavouring to provide end to end solutions to the Information Technology Industry with our expertise developed through the profound experience we continue contributing in training, consulting and Software Development Services all over Rajasthan. It provides information and resources on IT education, training, development and services for everyone involved in the sector - from students to educators and employers to employees. RAT through its strategic alliances with global leaders like Oracle formulates the link between individuals and agencies with IT skills, opportunities, and solutions.
  • 9. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 9 INTRODUCTION TO JAVA With the invention of microprocessors, the world is scientificallydeveloped with sophisticated equipment, systems, and devices. Microprocessors are used in computers, televisions, and fax machines. Even the hand-held devices such as pagers, PDAs (Personal Digital Assistant), and cell phones make use of microprocessors. All these electronic devices are helpful because of their communication capabilities. With the increasing capabilities and decreasing cost of information processing and networking technologies, the network is growing rapidly fortransmittinginformation throughelectronic systems. Internet is the network of networks between different types of computers located at different places to transmit information. Information can reach to any place in the world quicklyat a cheaper rate through the Internet. Thus, the Internet has made the world a global village for information exchange. The emerging infrastructure of electronic devices and interconnected computer networks create an environment that presents new challenges to software industries. For this emerging computing environment, Java process to b e a well – suited programming language. it is found suitable for networked environments involving a great variety of computer and devices. Java has many characteristics that have contributed to its popularity:  Platform independence - Many languages are compatible with only one platform. Java was specificallydesigned so that it would run on any computer, regardless if it was running Windows, Linux,Mac, Unix or any of the other operating systems.  Simple and easy to use - Java's creators tried to design it so code could be written efficiently and easily.  Multi-functional - Java can produce many applications from command-line programs to applets to Swing windows (basically, sophisticated graphical user interfaces). Java does have some drawbacks. Since it has automated garbage collection, it can tend to use more memory than other similar languages. There are often implementation differences on different platforms, which have led to Java being described as a "write once, test everywhere" system. Lastly, since it uses an abstract "virtual machine", a generic Java program doesn't have access to the Native API's on a system directly. None of these issues are fatal, but it can mean that Java isn't an appropriate choice for a particular piece ofsoftware.
  • 10. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 10 THE JAVA PLATFORM One thingthat distinguished Java from some other languages is its ability to run the same compiled code across multipleoperating systems. In other languages,thesource code (code that iswrittenby theprogrammer), iscompiled by a compiler into an executable file. This file is in machine language, and is intended for a single operating system/processor combination, so the programmer would have to re-compile the program separately for each new operating system/processor combination. Java is different in that it does not compile the code directly into machine language code. Compilation creates bytecode out of the source code. Bytecode generally looks something like this: a7 f4 73 5a 1b 92 7d When the code is run by the user, it is processed by something called the Java Virtual Machine (JVM). The JVM is essentially an interpreter for the bytecode. It goes through the bytecode and runs it. There are different versions of the JVM that are compatible with each OS and can run the same code. There is virtually no difference for the end-user, but this makes it a lot easier for programmers doing software development. Java and Open Source:-  In 2006 Sun started to make Java available under the GNU General Public License (GPL). Oracle continues this project called OpenJDK. Java Virtual machine :-  The Java virtual machine (JVM) is a software implementation of a computer that executes programs like a real machine.  The Java virtual machineis written specifically for a specific operating system, e.g. for Linux a special implementation is required as well as forWindows.  Java programs are compiled by the Java compiler into bytecode. The Java virtual machine interprets this bytecode and executes the Java program. Java Runtime Environment vs. Java Development Kit  A Java distribution comes typicallyin two flavors, the Java Runtime Environment (JRE) and the Java Development Kit (JDK).  The Java runtimeenvironment (JRE) consists of the JVM and the Java class libraries and contains the necessary functionality to start Javaprograms.  The JDK contains inaddition the development tools necessary to create Java programs. The JDK consists therefore of a Java compiler, the Java virtual machine, and the Java class libraries.
  • 11. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 11 INSTALLATION OF JAVA Checking Installation  Java mightalready be installed on your machine. You can test this by opening a console (if you are using Windows: Win+R, enter cmd and press Enter) and by typing in the following command:  java -version  If Java is correctly installed, you should see some information about your Java installation. If the command line returns the information that the program could not be found, you have to install Java. Installing the Java Development Kit  Before installingthe Java Development Kit (JDK), you should probably know what it is. It is distributed by Oracle. It contains the core libraries and compiler required to develop Java. The JDK should not be confused with the JRE (Java Runtime Environment). The JRE is a JVM for running, as opposed to compiling, Javaprograms. Downloading and Installing To download the JDK go to http://www.oracle.com/technetwork/java/javase/downloads/index.html Click on "JDK with NetBeans Bundle". Follow the instructions for downloading the JDK installationfile. Windows: If you are runningWindows, simplyrun the executable fileand followthe installation instructions. Unix, Solaris, or Linux: For Linuxand Unix,download the "jdk1 6.0" for Linuxsystems. Save the downloaded file in any drive. Once you have saved the file, extract it to a place that you can remember, by using Terminal or by double clicking on the file. When you have finishedextracting the file,copy the JDK 1.6.0 folder and paste it inthe usr/local(To paste to the usr/local directory, you have to be in root) so that every user can use the java files. You can delete the downloaded zip file so that it doesn't take up space on your drive. Macintosh: The latest available JDK is automatically installed by the operating system. Because Java for Macintosh is developed and maintained by Apple, in coordination with Sun, the current version on the Macintosh may not be the current version that is available Note on Editions  The JDK comes inthree editions.  Java Standard Edition (JSE) – This version is the basic platform for Java. The course will
  • 12. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 12 focus on this edition.  Java Enterprise Edition (JEE) – This edition is mainly for developing and running distributed multitier architecture Java applications, based largely on modular software components running on an application server. We willnot be covering this version in the course.  Java Micro Edition (JME) – This edition is primarilyfor developing programs to run on consumer applicances, such as PDAs and cellphones. CONFIGURING VARIABLES  Before writingcode, it is recommended that you set the Path variable on your system so you can compile your code more easily. For Windows Users  From the Control Panel, double click "System" (System and Maintenance in Vista)  For Windows Vista, 7, 8 and 10 click on "System," "Advanced System Settings" on the left, and then on "Environment Variables."  For XP and 2000, click on the "Advanced" tab and click on "Environment Variables" For NT, click on the "Environment" tab.  Select the Path variable and click "Edit"  Add the path to the bin directory of where Java is installed on your hard drive. It should probably be: C:Program FilesJavajdk1.6.0_20bin unless you changed it during installation.  Click OK For Linux and UNIX  One way to set your path in Linux/Unix is to add a path export to your bash profile.  In order to do this, first open your bash profile ina text editor. For example,  pico ~/.bash_profile  Then add this line:  export PATH=$PATH:/usr/local/jdk/bin  Note that the path to the java directory "/usr/local/jdk/bin" may be different on your machine.  Restart your shell.  For Macintosh
  • 13. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 13  Apple sets everything up for you. Sit back andrelax.  The onlydrawback is that because Apple handles development and maintenance of Java on the Mac, there isusuallya delay from the time that a new version is released by Sun and the timethatthenewversionisreleased on theMac. Also,gettingthelatestversionsometimesrequires an operating system upgrade.  Oh well, you can't have everything. Validate installation  Switch again to the command lineand run the following command.  java -version  The output should be similarto the following output.  java version "1.7.0_25"  OpenJDK RuntimeEnvironment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.13.04.2)  OpenJDK 64-Bit Server VM (build 23.7-b01, mixedmode) Development Process with Java  Java source files are written as plain text documents. The programmer typically writes Java source code in an Integrated Development Environment (IDE) for programming. An IDE supports the programmer in the task of writing code, e.g. it provides auto-formatting of the source code, highlighting of the important keywords, etc.  At some point the programmer (or the IDE) calls the Java compiler (javac). The Java compiler creates the bytecode instructions. These instructions are stored in .class files and can be executed by the Java Virtual Machine. Garbage collector  The JVM automaticallyre-collects the memory which is not referred to by other objects. The java garbage collector checks all object references and find the objects which can be automatically released.  Whilethe garbage collector releases the programmer from the need to explicitly manage memory theprogrammerstillneed to ensurethathedoes not keep unneeded object references otherwise the garbage collector cannot release the associated memory. Keeping unneeded object references are typically called memory leaks.
  • 14. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 14 Class path  The class path defines where the Java compiler and Java runtime look for .class files to load. This instructions can be used inthe Java program.  For example if you want to use an external Java library you have to add this library to your class path to use it in your program. WRITE, COMPILE AND RUN A JAVA PROGRAMME  Write source code  ThefollowingJava program is developed under Windows10 using a Notepad++.Theprocess on other operating system should be similar and but is not covered in this description.  Select or create a new directory which will be used for your Java development. On Microsoft Windows your mightwant to use c:tempjavastarter. Thispath iscalled javadir inthe following description. Open a text editor which supports plain text, e.g. gedit under Linux or Notepad++ under Windows and write the followingsource code. Save the source code in your javadir directory with the Hello.java filename. The name of a Java source file must always equals the class name (within the source code) and end with the .java extension. In this example the filename must be Hello.java because the class is called Hello. Compile and run your Java program  In Windows java programs can either be compile using the console block of Notepad++ or using CMD.  In both cases keywords used for compilation and running be same.  The difference is in the method of opening the window for console and cmd.  Both the methods can be opened using Notepad++.  For compiling javac filename.java is used.  For compilation of this file we use javac Hello.java.
  • 15. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 15  After compilation to execute the program we use java filename.  For this file we use java Hello is used  Compilation can be done using class name but can be run only by using file name.    
  • 16. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 16 COMPAIRISION BETWEEN C, C++ AND JAVA Java v/s C The difference between C and Java are as follows: C Language Java Language C is function oriented language. Java is an object oriented language. Basic programming unit is function. Basic programming unit is class. Compiled code is not portable; recompilation is required for each architecture. Compiled code is portable, Bytecode is Written once and run everywhere. Data types and there memory storage: Int-2 bytes;long-4bytes;char-1 byte Data types and there memory storage: Int-4 bytes;long-8bytes;char-2 byte It also have byte, short, Boolean data types. It follows ASCII code. It follows UNICODE. Variables must be declared at the beginning of the block. Variables can be declared anywhere before its first use. There are pointers in C. Java does not supports pointers. Supports function overloading, operator overloading. Supports function overloading only. Supports both narrowing(higher datatype to lower) and widening(lower datatype to higher). Supports widening for narrowing explicit typecasting is required. Does not support automatic garbage collection. Supports automatic garbage collection. No exception handling mechanism. Supports exception handling. C support the struct, union and pointer datatypes. Java does not support struct, union and pointer datatypes. Java v/s C++ The difference between C++ and Java are as follows: C++ Java C++ supports the struct, union and pointer data types. Java does not support struct, union and pointer datatypes. C++ supports typedef or #define. Java does not supports typedef or #define. C++ permits operator overloading. Java does not permits operator overloading. C++ supports multiple inheritance, hence virtual functions. Java does not supports multiple inheritance, so no virtual functions are there. Command Line Arguments are not handled like java. Java handles Command Line Arguments differently than C or C++. Null-terminated array of characters are used in C and C++. Java has string class as part of the java.lang package. Use memory allocation and de-allocation functions. Java has an automatic system for allocation and freezing memory (Garbage collection). Destructor are there in C++. No destructors in java. C++ refers on non-standard third party libraries. Java contains standard libraries for solving specific tasks.
  • 17. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 17 JAVA BASIC TERMS Basics: Package, Class and Object It is important to understand the base terminology of Java interms of packages, classes and objects. This section gives an overview of these terms. Packages Java groups classes into functional packages. Packages are typically used to group classes intological units. For example all graphical views of an application mightbe placed in the same package called com.vogella.webapplication.views. It is common practice to use the reverse domain name of the company as top level package. For examplethe company mightown the domain,vogella.com and inthisexampletheJava packages of this company starts withcom.vogella. Other main reason for the usage of packages is to avoid name collisions of classes. A name collision occurs if two programmers give the same fully qualified name to a class. The fully qualified name of a class inJava consists out of the package name followed by a dot (.) and the class name. Without packages, a programmer may create a Java class called Test. Another programmer may create a class with the same name. With the usage of packages you can tell the system which class to call. For example ifthe first programmer puts the Test class into package report and the second programmer puts his class into package xmlreader you can distinguish between these classes by usingthe fully qualified name, e.g. xmlreader.Test or report. Test.  Class Def.: Template that describes the data and behavior associated with an instance of that class. In Java source code a class is defined by the class keyword and must start with a capital letter. The body of a class is surrounded by {}. The data associated with a class is stored in variables ; the behavior associated to a class or object is implemented with methods. A class is contained in a Java source file with the same name as the class plus the .java extension.  Object Def.: An object is an instance of a class.
  • 18. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 18 The object is the real element which has data and can perform actions. Each object is created based on the class definition.
  • 19. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 19 INHERITANCE A class can be derived from another class. In this case this class is called a subclass. Another common phrase is that a class extends another class. The class from which the subclass is derived is called a superclass. Inheritance allows a class to inherit the behavior and data definitions of another class. The following codes demonstrates how a class can extend another class. In Java a class can extend a maximum of one class.
  • 20. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 20 VARIABLES AND METHODS  Variable Variables allow the Java program to store values during the runtime of the program. A variable can either be a primitive variable or a reference variable. A primitive variable contains value while the reference variable contains a reference (pointer) to the object. Hence if you compare two reference variables, you compare if both point to the same object. To compare objects use the object1.equals(object2) method call.  Instance variable Instance variable is associated with an instance of the class (also called object). Access works over these objects. Instance variables can have any access control and can be marked final or transient. Instance variables marked as final can not be changed after assigned to a value.  Local variable Local (stack) variable declarations cannot have access modifiers. final is the only modifier available to local variables. This modifier defines that the variable can not be changed after first assignment. Local variables do not get default values, so they must be initialized before use.  Methods A method is a block of code with parameters and a return value. It can be called on the object.
  • 21. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 21 Method can be declared with var-args. In this case the method declares a parameter which accepts from zero to many arguments (syntax: type .. name;) A method can only have one var-args parameter and this must be the last parameter in the method. Overwrite of a superclass method: A method must be of the exact same return parameter and the same arguments. Also the return parameter must be the same. Overload methods: An overloaded method is a method with the same name, but different arguments. The return type can not be used to overload a method  Constructor A class contains constructors that are invoked to create objects based on the class definition. Constructor declarations look like method declarations except that they use the name of the class and have no return type. A class can have several constructors with different parameters. Each class must define at least one constructor. Following is a simple example the constructor.
  • 22. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 22 METHOD AND CONSTRUCTOR OVERLOADING  Method overloading Method Overloading is a feature that allows a class to have more than one method having the same name, if their argument lists are different. It is similar to constructor overloading in Java that allows a class to have more than one constructor having different argument lists. To understand method overloading following programme can be use:
  • 23. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 23  Constructor overloading Like methods, constructors can also be overloaded. Constructor overloading is a concept of having more than one constructor with different parameters list, in such a way so that each constructor performs a different task. Following programme explains constructor overloading:
  • 24. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 24 SELECTION STATEMENTS Java supports two selection statements: if and switch. These statements allow you to control the flow of your programme’s execution based upon certain conditions during runtime. 1. if statement a) Simple if b) Simple if else c) Nested if d) Nested if else 2. switch statement if Statement This if statement is used if we wish to execute a statement if a condition is true. If statement has many forms and is very powerful in dealing with statements where we want to do selection based on condition. Flow Chart:- Simple if else Flow Chart:- Nested if else
  • 25. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 25 Flow Chart:- if else ladder switch-case statement The value in parentheses just after the switch keyword is called the expression of the switch statement, and it must be of type byte, short, char, or int. When the switch code is executed, Java searches through the case statements, looking for one that matches the expression's value. [1.]If no match is found, default block is executed if it is present, default is an optional block else execution continues after the closing curly bracket. [2.]If a match is found, control jumps to the first executable line following the case statement. Then execution proceeds line by line until a break statement is reached. At this point, execution of the switch code is terminated, and control continues after the closing curly bracket.
  • 26. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 26 MODIFIERS  Access modifiers There are three access modifiers keywords available in Java. public, protected and private. There are four access levels: public, protected, default and private. They define how the corresponding element is visible to other components. If something is declared public, e.g. classes or methods can be freely created or called by other Java objects. If something is declared private, e.g. a method, it can only be accessed within the class in which it is declared. protected and default are similar. A protected class can be accessed from the package and sub-classes outside the package while a default class can get only accessed via the same package. The following table describes the visibility: Table 1. Access Level Modifier Class Package Subclass World Public Y Y Y Y protected Y Y Y N Modifier Class Package Subclass World no modifier Y Y N N Private Y N N N Other modifiers  final methods: cannot be overwritten in a subclass  abstract method: no method body  synchronized method: threat safe, can be final and have any access control  native methods: platform dependent code, apply only to methods  strictfp: class or method Import statements  Usage of import statements In Java you have to access a class always via its full-qualified name, e.g. the package name and the class name. You can add import statements for classes or packages into your class file, which allow you to use the related classes in your code without the package qualifier.  Static imports Static import is a feature that allows members (fields and methods) which are defined in a class with the public static access modifier to be used in Java code without specifying the class in which the member is defined. The feature provides a type safe mechanism to include constants into code without having to reference the class that originally defined the field.
  • 27. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 27 INTERFACE Interfaces are contracts for what a class can do but they say nothing about the way in which the class must do it. An interface is a type similar to a class. Like a class an interface defines methods. An interface can have only abstract methods, no concrete methods are allowed. Methods defined in interfaces are by default public and abstract – explicit declaration of these modifiers is optional. Interfaces can have constants which are always implicitly public, static and final. A class can implement an interface. In this case it must provide concrete implementations of the interface methods. If you override a method defined by an interface you can also use the @override annotation.  Abstract class and methods A class and method can be declared as abstract. An abstract class can not be directly instantiated. If a class has at least one method which only contain the declaration of the method but not the implementation then this class is abstract and can not be instantiated. Sub-classes need then to define the methods except if they are also declared as abstract. If a class contains an abstract method it also needs to get defined with the keyword abstract. The following example shows an abstract class.
  • 28. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 28 INTEGRATED DEVLOPMENT ENVIORNMENT The previous chapter explained how to create and compile a Java program on the command line. A Java Integrated Development Environment (IDE) provides lots of ease of use functionality for creating java programs. There are other very powerful IDE's available, for example the Eclipse IDE. . For an introduction on how to use the Eclipse IDE please see Eclipse IDE Tutorial. The remaining description uses the phrase: Create a Java project called... ". This refers to creating a Java project in Eclipse. If you are using a different IDE please follow the required steps in this IDE. Exercises - Creating Java objects and methods Create a Person class and instantiate it Create a new Java project called com.vogella.javastarter.exercises1 and a package with the same name. Create a class called Person. Add three instance variables to it, one for storing the first name of the person, on for storing the last name and one for storing the age of the Person. Use the constructor of the Person object to set the values to some default value. Write a public method called writeName() which uses the System.out.println( method to print the first name of the person to the console. Create a new class called Main with a public static void main(String[] args). In this method create an instance of the Person class.
  • 29. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 29 HISTORY OF JAVA It is quite interesting to know the development of Java technology, which is widely accepted in the area of networked/distributed computing. Java evolved from a project developing a language for programming consumer electronic devices at Sun Microsystems, USA. Sun’s Stealth Project in 1990 was aimed to do research in the area of application of computers in the consumer electronics market. Bill Joy, James Gosling, Mike Sheridan, Patrick Naughton (formerly the project leader of Sun’s Open Windows user environment), and several other individuals discussed the ideas for the Stealth Project in January 1991.The vision of this project was to develop smart consumer electronic devices that could all be centrally controlled and programmed from a handheld-remote-control-like device. The Stealth group began to work to achieve this goal. It was realized that a platform-independent development- environment was needed. Green Project was initiated by Patrick Naughton, Mike Sheridan, and James Gosling of Sun Microsystems in 1991 (Members of the Stealth Project, which later became known as the Green Project) The tasks of the project were divided amongst the members of Green Project. Mike Sheridan concentrated on business development, Patrick Naughton worked on the graphics system, and James Gosling was to identify the appropriate programming language for the Green Project. Even though creating a new language was not the aim of Green Project, a new language was created as a programming tool in this project since C++ was found unsuitable for the project. An intelligent remote control called *7 (Star Seven) was delivered as the first product of Green Project in 1992. It is a PDA- like device comprising of a new language oak, an operating system called GreenOS, user interface, and hardware. This device was quite impressive to Sun Executives. But no customer was interested in this project. The market was not conducive to this type of device in the consumer electronics industry. The new language Oak was created by James Gosling, a Green Team member, specifically for *7. Gosling named the new language Oak because that name was struck while looking at an oak three outside of his office window. The name Oak was later renamed to Java in order to avoid legal issues since Oak was the name of an existing language. In November 1992, the Green Project was incorporated under the name FirstPerson. In 1993. Time-Warner was demanding for proposals for set-top box operating systems and videoon- demand technology with an objective of sending the data to consumer all over the country for display on the television sets. At the same time (1993(, NCSA released the first graphical web browser Mosaic 1.0, an easy-to-use front end to the World Wide Web. When FirstPerson was bidding on the Time-Warner TV trial based on video-on-demand technology, Time-Warner chose Silicon Graphics, Inc. (SGI) over Sun. Hence, half of the members of FirstPerson left for SGI and the remaining members continued to work at Sun.
  • 30. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 30 Mosaic web browser revolutionized people’s perceptions. The remaining member of FirstPerson returned to work on Java (Oak was renamed Java) to develop Java-based web browser. FirstPerson was dissolved gradually. Naughton and Jonathan Payne developed WebRunner (named after the movie Blade Runner). Later WevRunner was officially announced as the HotJavaTM browser in 1994. This was the turning point for Java. At that time the World Wide Web changed the face of Internet and it was winning the race on Internet. Arthur Ban Hoff implemented the Java compiler in Java itself whereas Gosling implemented it in C. The Java compiler, written in Java made the people to accept Java as a fullfeatured language. Sun Microsystems officially announced Java environment at Sun World’95 on May 23, 1995. Java entered into the mainstream of the Internet after a struggle for about four years. Netscape Communications incorporated Java into its web browser Netscape Navigator. Within a decade, Java was destined to be the most overreaching technology in the Internet. Java was not restricted to the Internet alone. The initial goal of Sun was also achieved by using Java technology in interactive set-top boxes, hand-held devices and other consumer electronics products. Sun released the first version 1.0 of Java in 1996. Java is an object-oriented programming language which evolved from C++. It is also a high-level programming language. The different forms of Java versions are discussed in the next section. History of JAVA Year Java - Versions and Features 1990 Sun Microsystems started Stealth project supporting application of computers in the consumer electronics market. 1991 The Green project started with the members of Stealth project such as James Gosling, Patrick Naughton, and Mike Sheridan. A new programming language, called Oak was created by Gosling. 1992 An intelligent remote control called StarSeven was delivered. The Green Project was incorporated was incorporated under the name FirstPerson. 1993 Mosaic Web browser was introduced in the world of Internet. 1994 HotJava Web browser was announced by Sun Microsystems. 1995 Oak was renamed as Java. Sun officially announced Java technology. 1996 Sun released the first version 1.0 of Java. Core Language features supporting: I/O facility, Utilities, Network Programming, User Interface – AWT, Applets, and Multithreading. 1997 Sun released JDK1.1 by including new features such as addition of inner classes to the language and capabilities such as JavaBeans, JDBC(Java Data Base Connectivity), and RMI (Remote Method Invocation).
  • 31. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 31 1998 Java 2 Platform, Standard Edition (J2SE)1.2, code named as Playground, was released. It replaced JDK and distinguished the base platform from j2ee (Java 2 Platform, Enterprise Edition) and J2ME (Java 2Platform, Micro Edition). The key features include Swing graphical API, Java IDL (Interface Definition Language) to support CORBA interoperability. They also added Collections framework to support various data structures. For the first time, JVM was equipped with a JIT (Just-in Time) compiler. 2000 J2SE 1.3, code named as Kestrel, was released with key features such as Java Sound API to support audio operations (e.g., audio playback and capture/recording, mixing, sequencing, and synthesis), Java Naming and Directory Interface (JNDI), and Java Platform Debugger Architecture (JPDA). 2002 H2SE 1.4, code named as Merlin, was released with key features such as (a) image I/O API for manipulating images in formats like JPEG and PNG, (b) integrated XML parser and XSLT processor (JAXP), integrated security and cryptography extensions, (c) Java Web Start supporting deployment of Java software applications over the network. 2004 J2SE 5.0, code named as Tiger, was released with enhancement of Java platform and inclusion of a number of significant new language features such as Generics, Enhanced for Loop, Autoboxing/Unboxing, Typesafe Enums, Varags, Static Import, and Metadata supporting declarative style programming annotation of source code. 2006 Java SE 6.0, code named as Mustang, was released with enhancement of performance in Swing, JDBC 4.0 support, Java Compiler API, Upgrade of JAXB to version 2.0, including integration of a StAX parser, support for pluggable annotations, and many GUI improvements. 2008 Java SE 7.0, code named as Dolphin, with native support for XML recognizing its foundation for Web services.
  • 32. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 32 JAVA ADVANTAGES AND DISADVANTAGES Java is a general-purpose, high-level programming language initially designed for handheld devices and set-top boxes. Java was repurposed in 1995 to create applications on the World Wide Web. Today, Java is commonly used for creating web and mobile applications. There are several advantages and disadvantages of using Java that have been listed below. Advantages Simple: Java was designed to be easy to use, write, compile, debug, and learn than other programming languages. Java is much simpler than C++ because Java uses automatic memory allocation and garbage collection. Object-Oriented: Object oriented programming is associated with concepts like class, object, inheritance, encapsulation, abstraction, polymorphism, etc. which allows you to create modular programs and reusable code. You can declare classes, create objects inside classes, and interact between two objects. Platform-Independent: Java offers the comfort of write program once and run on any hardware and software platform and any Java compatible browser. This gives the ability to move easily from one computer system to another. Distributed: Java has great networking capability, it is designed to make distributed computing easy with the networking capability that is inherently integrated into it. Secure: Java is the first programming language to include security an integral part of the design. Java’s compiler, interpreter, and runtime environment were each developed with security in mind. Java Virtual Machine has a unique identifier that identifies the bytecode and verifies it before running it. Allocation: Java has the feature of Stack allocation system. It follows LIFO (Last in First Out) which helps the data to be stored and retrieved easily. Multithreaded: Java is one of the programming languages to support Multithreading. Multithreading is the capability for a program to perform several tasks simultaneously within a program. Rich APIs: Java offers various APIs for application development. Java APIs (Application Programming Interface) is the set of commands or methods of communication among various activities like Database connection, networking, I/O, XML parsing, utilities, and much more. Powerful Open source Rapid Development Tools: Over the year’s several open source development tools i.e., IDEs such as Eclipse and Netbeans, have been created with Java as a base which makes Java more powerful for application development. IDEs makes application development simpler with powerful coding and debugging features.
  • 33. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 33 Robust: Java is one of the most robust programming languages, that is Java is more reliable. Java compilers can detect any errors in the coding. There are also other features like exception handling and garbage collection which makes Java more robust. Resource Availability: There are tons of online java training courses available to learn java. You don’t have to spend a fortune to learn java programming. Disadvantages Performance: Significantly slower and more memory-consuming than natively compiled languages such as C or C++. Look and feel: The default look and feel of GUI applications written in Java using the Swing toolkit is very different from native applications. Single-paradigm language: The addition of static imports in Java 5.0 the procedural paradigm is better accommodated than in earlier versions of Java.
  • 34. First Year Practical Training Report, Academic Year 2019-2020, PIET, Jaipur 34 REFERENCE [1.]www.udemy.com [2.]Programming in JAVA (Student Learning Booklet of Road Ahead Technology) [3.]https://www.mindsmapped.com/java-advantages-and-disadvantages/