History of Java Programming Language - PDF

Document Details

GratefulDallas8635

Uploaded by GratefulDallas8635

University of the East

Tags

Java programming language Java technology JVM computer programming

Summary

This document is an introduction to the Java programming language, including a history of its development, key features, and technological aspects. It covers topics such as the Java Virtual Machine (JVM), garbage collection, code security, and different types of Java programs. The content is useful for understanding the fundamentals of Java and its impact on application development.

Full Transcript

Computer Programming 2 Module 1: Introduction to Java Programming Language History of Java programming language Meet the team  James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of SUN Microsystems engineers call...

Computer Programming 2 Module 1: Introduction to Java Programming Language History of Java programming language Meet the team  James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of SUN Microsystems engineers called Green Team.  Firstly, it was called "Greentalk" by James Gosling, and the file extension was.gt.  After that, it was called Oak and was developed as a part of the Green project. Why Java named "Oak"?  Why Oak? Oak is a symbol of strength and chosen as a national tree of many countries like the U.S.A., France, Germany, Romania, etc.  In 1995, Oak was renamed as "Java" because it was already a trademark by Oak Technologies. Why Java programming language named "Java"?  Why had they chosen java name for Java language? The team gathered to choose a new name. The suggested words were "dynamic", "revolutionary", "Silk", "jolt", "DNA", etc. They wanted something that reflected the essence of the technology: revolutionary, dynamic, lively, cool, unique, and easy to spell and fun to say.  According to James Gosling, "Java was one of the top choices along with Silk". Since Java was so unique, most of the team members preferred Java than other names.  Java is an island of Indonesia where the first coffee was produced (called java coffee). It is a kind of espresso bean. Java name was chosen by James Gosling while having coffee near his office.  Notice that Java is just a name, not an acronym. Changes and the current state of Java programming language  Initially developed by James Gosling at SUN Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995.  In 1995, Time magazine called Java one of the Ten Best Products of 1995.  Java Development Kit (JDK) 1.0 released in January 23, 1996. After the first release of Java, there have been many additional features added to the language. Now Java is being used in Windows applications, Web applications, enterprise applications, mobile applications, cards, etc. Each new version adds the new features in Java.  Currently, Java is used in internet programming, mobile devices, games, e-business solutions, etc. The original motivation for Java programming language  The need for platform independent language that could be embedded in various consumer electronic products like toasters and refrigerators.  One of the first projects developed using Java is a personal hand-held remote control named Star 7.  At about the same time, the World Wide Web and the Internet were gaining popularity. Gosling et. al. realized that Java could be used for Internet programming. The Java programming language technology  A programming language As a programming language, Java can create all kinds of applications that you could create using any conventional programming language.  A development environment As a development environment, Java technology provides you with a large suite of tools, among them are: o A compiler (javac) o An interpreter (java) o A documentation generator (javadoc) o A class file packaging tool  An application environment Java technology applications are typically general-purpose programs that run on any machine where the Java Runtime Environment (JRE) is installed.  A deployment environment There are two main deployment environments: o The JRE supplied by the Java 2 Software Development Kit (SDK) contains the complete set of class files for all the Java technology packages, which includes basic language classes, Graphical User Interface (GUI) component classes, and so on. o The other main deployment environment is on your web browser. Most commercial browsers supply a Java technology interpreter and runtime environment. Some features of Java programming language  The Java Virtual Machine Java Virtual Machine (JVM) is an imaginary machine that is implemented by emulating software on a real machine; provides the hardware platform specifications to which you compile all Java technology code. Bytecode is a special machine language that can be understood by the Java Virtual Machine (JVM).  Garbage Collection Responsible for freeing any memory that is no longer in use by the application. This happens automatically during the lifetime of the Java program.  Code Security Code security is attained in Java through the implementation of its Java Runtime Environment (JRE). JRE runs code compiled for a JVM and performs class loading (through the class loader), code verification (through the bytecode verifier) and finally code execution. Class Loader is responsible for loading all classes needed for the Java program. Bytecode verifier tests the format of the code fragments and checks the code fragments for illegal code that can violate access rights to objects. Phases of a Java Program Task Tool to use Output Write the program Any text editor File with.java extension Compile the program Java compiler File with.class extension Run the program Java interpreter Program output Two types of Java Program  Applets program Java programs designed to run on a Web browser. Java applets are used to provide interactive features to web applications and can be executed by browsers for many platforms. They are small, portable Java programs embedded in HTML pages and can run automatically when the pages are viewed.  Application program (Stand-alone application) Java programs which do not require Web browser. Java programs that can be developed and executed on a stand-alone local computer. (Executed from the command prompt). The stand-alone application can be executed without the browsers (Internet connectivity). A java program is not embedded within HTML or any other language and can stand on its own. Java Tokens  Token The smallest individual unit of a program written in any programming language. Java Tokens are the smallest individual building block or smallest unit of a Java program; the Java compiler uses it for constructing expressions and statements. Java’s tokens are divided into five:  Reserved Words / Keywords Keywords are pre-defined or reserved words in a programming language. Each keyword is meant to perform a specific function in a program. Since keywords are referred names for a compiler, they can’t be used as variable names because by doing so, we are trying to assign a new meaning to the keyword which is not allowed.  Special Symbols Special symbols in Java are a few characters which have special meaning known to Java compiler and cannot be used for any other purpose.  Literals Literals in Java are similar to normal variables but their values cannot be changed once assigned. In other words, literals are constant variables with fixed values. These are defined by users and can belong to any data type. Java supports five types of literals which are as follows:  Integer (int)  Floating Point (float, double)  Character (char)  String (String)  Boolean (boolean)  Identifiers Identifiers are used to name a variable, constant, method or function, class, and array.  Operators Java provides many types of operators which can be used according to the need. They are classified based on the functionality they provide. Some of the operators are the following:  Arithmetic operators  Logical operators  Relational operators Java Comments The Java comments are the statements in a program that are not executed by the compiler and interpreter. Why do we use comments in a code?  Comments are used to make the program more readable by adding the details of the code.  It makes easy to maintain the code and to find the errors easily.  The comments can be used to provide information or explanation about the variable, method, class, or any statement.  It can also be used to prevent the execution of program code while testing the alternative code. Types of Java Comments  Single line comment The single-line comment is used to comment only one line of the code. It is the widely used and easiest way of commenting the statements. Single line comments starts with two forward slashes (//). Any text in front of // is not executed by Java.  Multi-line comment The multi-line comment is used to comment multiple lines of code. It can be used to explain a complex code snippet or to comment multiple lines of code at a time (as it will be difficult to use single-line comments there). Multi-line comments are placed between. Any text between is not executed by Java.  Documentation comment Documentation comments are usually used to write large programs for a project or software application as it helps to create documentation API. These APIs are needed for reference, i.e., which classes, methods, arguments, etc., are used in the code. To create documentation comments, we need to use the javadoc tool. The documentation comments are placed between. Quick Review Program is a sequence of statements intended to accomplish a task. Programming is a process of planning and creating a program. Programming language a set of rules, symbols, and special words used to construct programs. Data type is a set of values with a set of operations on those values. Package is a collection of related classes. Class is used to create java programs, either application or applet; It is the basic unit of a java program; It is a collection of methods and data members Method is a set of instructions to accomplish a specific task; It is the functional element of an object. The following are some predefined or standard methods: nextInt() nextDouble() print() println() A java identifier consists of letters, digits, the underscore character(_) and the dollar sign ($) and must begin with letter,underscore or a dollar sign. Must not be a keyword or a reserved word. Naming conventions used in Java programming language are Pascal case and Camel case. PascalCase are used in naming Classes while camelCase are used in naming variables. Hungarian notations are not suitable for Java application programs. Errors are bugs in a program. Syntax error is a type of error which is considered as a programmer’s error; it is also called as a compile-time error. Another type of error is a Run-time error which is also known as a logical error; errors that will not display until you run or execute your program. References: https://ecomputernotes.com https://www.javatpoint.com Java programming: From problem analysis to program design, D.S. Malik Orange & Bronze Software Labs Ltd. Co.