
































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An overview of the java programming language, including its history, key features, and development process. It covers topics such as the java virtual machine (jvm), the java runtime environment (jre) and java development kit (jdk), package and class structure, variables and methods, access modifiers, and the use of import statements. The document also discusses abstract classes and methods, as well as the process of creating and working with java classes and objects. Overall, this document serves as a comprehensive introduction to the fundamental concepts and practices of java programming, making it a valuable resource for students, developers, and anyone interested in learning this widely-used language.
Typology: Schemes and Mind Maps
1 / 40
This page cannot be seen from the preview
Don't miss anything!
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 Md. Danaeyal Hussan , teacher at HP Education Services, Patna for his cooperation and guidance. I am also thankful to his Lab assistant that provided staunch support throughout this training and helped me to complete the training successfully
Furthermore I would also like to acknowledge with much appreciation the crucial role of our HOD Prof. Sandeep Goyal 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 thank to God for being kind to me and driving me through this journey.
Sumit Kumar Sharma
MAHARISHI MARKANDESHWAR UNIVERSITY MULLANA, AMBALA
APPROVAL CERTIFICATE
This dissertation work entitled “ Industrial Training Report on CORE JAVA ” submitted by Mr. Sumit Kumar Sharma is approved for the award of degree of Bachelor of Technology in Computer Science and Engineering.
Date: Date:
HISTORYOF 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 video-on- 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.
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 full-featured 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.
FEATURES OF JAVA
According to Sun, Java is defined as a simple, object-oriented, distributed, interpreted, robust, secure, architecture – neutral, portable, high performance, multithreaded, and dynamic programming language and platform.
Java is simple because the syntax of well-known languages such as C and C++ are used with modifications meant for simplification and improvement. It is easy to read and write Java code if the reader is familiar with C/C++.
Almost everything in Java is centered on creating objects, manipulating the objects and making objects work together. Only the primitive operations and data types are at the sub-object level. Hence Java is an object-oriented programming language.
An application can be distributed in many systems which are connected together. Since networking capability is incorporated in Java, the data/file can be sent across many systems to run the application.
Java is robust because it is more reliable. It ensures the reliability by providing early checking for possible errors. It eliminates error-prone constructs such as pointer. It eliminates error-prone constructs such as pointer. It also supports runtime error handling.
Java programs are compiled to a byte code format that can be read and run by interpreters on many platforms including Windows, Linux, etc. Hence, it is architecture neutral. Because of this feature it is portable to new hardware and operating systems.
Although the speed of execution of Java programs is slower compared to C/C++ programs, Java is meant for distributed applications. Whenever the file/data is transmitted from one system to another, the performance is not affected. Hence, it is having high performance.
Java supports multithreaded programming to perform several tasks simultaneously. Any code can be loaded without recompilation at runtime. Hence it is dynamic.
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 of software.
THE JAVA PLATFORM
One thing that distinguished Java from some other languages is its ability to run the same compiled code across multiple operating systems.In other languages, the source code (code that is written by the programmer), is compiled 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 seperately 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.
The Java virtual machine (JVM) is a software implementation of a computer that executes programs like a real machine.
INSTALLATION OF JAVA
Java might already 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.
Before installing the 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, Java programs.
To download the JDK, go to http://www.oracle.com/technetwork/java/javase/downloads/index.html. Click on "JDK with Net Beans Bundle". Follow the instructions for downloading the JDK installation file.
installation instructions.
systems. 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 finished extracting the file, copy the JDK 1.6.0 folder and paste it in the user/local (To paste to the user/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.
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
The JDK comes in three editions. Java Standard Edition (JSE) – This version is the basic platform for Java. The course will 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 will not be covering this version in the course. Java Micro Edition (JME) – This edition is primarily for developing programs to run on consumer appliances, such as PDAs and cell phones.
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 byte code instructions. These instructions are stored in .class files and can be executed by the Java Virtual Machine.
The JVM automatically re-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. While the garbage collector releases the programmer from the need to explicitly manage memory the programmer still need to ensure that he does not keep unneeded object references otherwise the garbage collector cannot release the associated memory. Keeping unneeded object references are typically called memory leaks.
The class path defines where the Java compiler and Java runtime look for .class files to load. This instruction can be used in the 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 PROGRAM
Let us look at a simple code that would print the words Hello World.
public class MyFirstJavaProgram{ /* This is my first java program.
Let's look at how to save the file, compile and run the program. Please follow the steps given below: Open notepad and add the code as above. Save the file as: MyFirstJavaProgram.java. Open a command prompt window and go o the directory where you saved the class. Assume it's C:. Type ' javac MyFirstJavaProgram.java ' and press enter to compile your code. If there are no errors in your code, the command prompt will take you to the next line (Assumption: The path variable is set).