PROGRAMMING IN JAVA UNIT I A Brief History

PROGRAMMING IN JAVA UNIT I

A Brief History � The object-oriented paradigm took its shape from the initial concept of a new programming approach, while the interest in design and analysis methods came much later. � The first object–oriented language was Simula (Simulation of real systems) that was developed in 1960 by researchers at the Norwegian Computing Center. � In 1970, Alan Kay and his research group at Xerox PARK created a personal computer named Dynabook and the first pure object-oriented programming language (OOPL) - Smalltalk, for programming the Dynabook. � In the 1980 s, Grady Booch published a paper titled Object Oriented Design that mainly presented a design for the programming language, Ada. In the ensuing editions, he extended his ideas to a complete object–oriented design method. � In the 1990 s, Coad incorporated behavioral ideas to object-oriented methods. Object-Oriented Analysis ◦ Identifying objects ◦ Organizing the objects by creating object model diagram ◦ Defining the internals of the objects, or object attributes ◦ Defining the behavior of the objects, i. e. , object actions ◦ Describing how the objects interact �

OOPS concepts are 1) Class The class is a group of similar entities. It is only an logical component and not the physical entity. For example, if you had a class called “Expensive Cars” it could have objects like Mercedes, BMW, Toyota, etc. Its properties(data) can be price or speed of these cars. While the methods may be performed with these cars are driving, reverse, braking etc. 2) Object An object can be defined as an instance of a class, and there can be multiple instances of a class in a program. An Object contains both the data and the function, which operates on the data. For example - chair, bike, marker, pen, table, car, etc. 3) Inheritance is an OOPS concept in which one object acquires the properties and behaviors of the parent object. It’s creating a parent-child relationship between two classes. It offers robust and natural mechanism for organizing and structure of any software. 4) Polymorphism � Polymorphism refers to the ability of a variable, object or function to take on multiple forms. For example, in English, the verb “run” has a different meaning if you use it with “a laptop, ” “a foot race, and ”business. &rdquo Here, we understand the meaning of “run” based on the other words used along with it. The same also applied to Polymorphism.

5) Abstraction � An abstraction is an act of representing essential features without including background details. It is a technique of creating a new data type that is suited for a specific application. For example, while driving a car, you do not have to be concerned with its internal working. Here you just need to concern about parts like steering wheel, Gears, accelerator, etc. 6) Encapsulation � Encapsulation is an OOP technique of wrapping the data and code. In this OOPS concept, the variables of a class are always hidden from other classes. It can only be accessed using the methods of their current class. For example - in school, a student cannot exist without a class. Advantages of OOPS: ◦ OOP offers easy to understand a clear modular structure for programs. ◦ Objects created for Object-Oriented Programs can be reused in other programs. Thus it saves significant development cost. ◦ Large programs are difficult to write, but if the development and designing team follow OOPS concept then they can better design with minimum flaws. ◦ It also enhances program modularity because every object exists independently.

HISTORY OF JAVA § § James Gosling Mike sheridan, and Patrick Naughton initiated the Java language project in June 1991. Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time. The language was initially called Oak after an oak tree that stood outside Gosling's office. Later the project went by the name Green and was finally renamed Java, from Java coffee. Gosling designed Java with a C/C++-style syntax that system and application programmers would find familiar. Sun Microsystems Released the first public implementation as Java 1. 0 in 1996. It promised "Write Once, Run Anywhere" (WORA), providing no-cost run-times on popular platforms. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. The Java 1. 0 compiler was re-written in Java by Arthur van Hoff to comply strictly with the Java 1. 0 language specification.


* Simple: The Java language is easy to learn. Java code is easy to read and write. * Familiar: Java is similar to C/C++ but it removes the drawbacks and complexities of C/C++ like pointers and multiple inheritances. So if you have background in C/C++, you will find Java familiar and easy to learn. * Object-Oriented: Unlike C++ which is semi object-oriented, Java is a fully object-oriented programming language. It has all OOP features such as abstraction, encapsulation, inheritance and polymorphism. * Robust: With automatic garbage collection and simple memory management model (no pointers like C/C++), plus language features like generics, try-with-resources, … Java guides programmer toward reliable programming habits for creating highly reliable applications. * Secure: The Java platform is designed with security features built into the language and runtime system such as static type-checking at compile time and runtime checking (security manager), which let you creating applications that can’t be invaded from outside. You never hear about viruses attacking Java applications.

* High Performance: Java code is compiled into bytecode which is highly optimized by the Java compiler, so that the Java virtual machine (JVM) can execute Java applications at full speed. In addition, computeintensive code can be re-written in native code and interfaced with Java platform via Java Native Interface (JNI) thus improve the performance. * Multithreaded: The Java platform is designed with multithreading capabilities built into the language. That means you can build applications with many concurrent threads of activity, resulting in highly interactive and responsive applications. * Platform Independence: Java code is compiled into intermediate format (bytecode), which can be executed on any systems for which Java virtual machine is ported. That means you can write a Java program once and run it on Windows, Mac, Linux or Solaris without re-compiling. Thus the slogan “Write once, run anywhere” of Java.

JAVA DIFFERS FROM C AND C++ Java and C � � � � � Java does not include the C unique statement keywords size of and typedef. Java does not contain the data type struct and union. Java does not define the type modifiers keywords auto, extern, register, signed, and unsigned. Java does not support an explicit pointer type. Java does not have a preprocessor and therefore we cannot use # define, # include, and # ifdef statements. Java requires that the functions with no arguments must be declared with empty parenthesis and not with the void keyword as done in C. Java adds new operators such as instanceof and >>>. Java adds labelled break and continue statements. Java adds many features required for object-oriented programming.

Java and C++ � Java does not support operator overloading. � Java does not have template classes as in C++. � Java does not support multiple inheritances of classes. This is accomplished using a new feature called “Interface”. � Java does not support global variables. Every variable and method is declared within classes and forms part of that class. � Java does not use pointers. � Java has replaced the destructor function with a finalize() function. � There are no header files in Java.

Java and Internet � Java is strongly associated with the internet because of the first application program is written in Java was hot Java. � Web browsers to run applets on the internet. � Internet users can use Java to create applet programs & run then locally using a Java-enabled browser such as hot Java. � Java applets have made the internet a true extension of the storage system of the local computer.


World wide web and internet ◦ World wide web is a collection of information stored on internet computers. ◦ World wide web is an information retrieval system designed to be used in the internet’s distributed environment. ◦ World wide web contains web pages that provide both information and controls. ◦ Web pages contain HTML tags that enable us to find retrieve, manipulate and display documents world wide. ◦ Before Java, the world wide web was limited to the display of still images & texts. ◦ With the help of Java WWW is capable of supporting animation graphics, games and wide rage special effects.

World wide web and internet

Java tokens
- Slides: 15