Full form of Java: – The unofficial Java abbreviation is Just Another Virtual Analyzer (JAVA). But actually, it is said that JAVA has no full form. The Java is one of the technology or programming languages used to develop web applications.
The Java programming language was originally developed by Sun Microsystems, which was started by James Gosling and launched in 1995 as a core component of the Sun Microsystems’ Java platform.
The latest version of Java Standard Edition is Java SE 8. With the advance of Java and its widespread popularity, multiple configurations were created to adapt to various types of platforms. For example: J2EE for business applications, J2ME for mobile applications. The new versions of J2 were renamed as Java SE, Java EE and Java ME respectively. Java is guaranteed to write once, run anywhere.
Sun Microsystems Started by a group of students studying at Standard University. These people found the problem in their room with electronic remote control. That means that an electronic consumable control does not work with another electronic consumable.
These people want to develop a common remote control that controls all electronic consumables, so they communicate with James Gosling and request the projects. Sun Microsystems began with a group of students, including an Indian person, whose name is Vinode Khosla.
James Gosling and his team members who received the name of the project as Green began in 1990 and the common remote control was completed in 1992.
The James Gosling team develops a new language called OAK, but this name has already been selected by any other company whose name has been called Java, but Java does not have a significant representation of Island in Indonesia.
Java version history
Now 8 java versions are released one day, which are listed below with date of realization.
JDK Alpha and Beta (1995)
JDK 1.0 (January 23, 1996)
JDK 1.1 (February 19, 1997)
J2SE 1.2 (December 8, 1998)
J2SE 1.3 (May 8, 2000)
J2SE 1.4 (February 6, 2002)
J2SE 5.0 (September 30, 2004)
Java SE 6 (December 11, 2006)
Java SE 7 (July 28, 2011)
Java SE 8 (March 18, 2014)
Tools you will need
To perform the examples described in this tutorial, you will need a 200 MHz Pentium computer with a minimum of 64 MB of RAM (128 MB of RAM is recommended).
You will also need the following software’s:
- Windows xp / 7/8 operating system or Linux 7.1
Java JDK 8
- Microsoft Notepad or any other text editor.
Java can be used to create two types of programs: applets and independent applications. An applet is simply a part of a web page, such as an image or a line of text. Just as a browser is concerned with displaying an image referenced in an HTML document, a Java-enabled browser locates and runs an applet. When your Java-compatible web browser loads the HTML document, the Java applet also loads and runs.
With applets, you can do everything from adding animated graphics to your web pages to creating complete games and utilities that can be run over the Internet.
Some applets that have already been created with Java include a bar chart, which embeds a configurable bar chart in an HTML document; Crossword puzzle, which allows users to solve a crossword puzzle on the Web; and LED Sign, which presents a computerized and scrolling message for the viewers of the web page in which the applet is embedded.
Although most Java programmers are excited about the ability to create applets, Java can also be used to create separate applications, that is, applications that do not need to be embedded in an HTML document. The best known application is the Hot Java web browser.
This basic browser is completely written in the Java language, and shows how Java handles not only normal programming tasks, such as looping and evaluating mathematical expressions, but also how it can handle the complexities of programming of telecommunications.
The Java Developer’s Kit
Java is actually more than a computer language; It is also a programming environment that includes a complete set of programming tools. These tools comprises of an interpreter, a profiler, compiler, a debugger, a disassembler and more. First use a text editor to create the source code file in the creation of Java program.
You can write the source code in the Java language. After completing the source code, which is always saved with a .java file extension, compile the program in its byte code format, the file for which it has the .class file extension. It is the .class file which the interpreter loads and implements. Because the byte code files are completely portable between operating systems, they can be run on any system that has a Java interpreter.
Features of JAVA;
It is simple due to the following factors:
- It is pointer free because this application runtime has been improved. [When we write a Java program without pointers, it internally becomes the equivalent pointer program].
- It has a rich set of API (application protocol interface).
- It is a garbage collector that is always used to collect memory location without reference (not used) to improve the performance of a Java program.
- It contains an easy to use syntax to develop any application.
- Independent platform;
If and only if technology can be run on all available operating systems with respect to its development and compilation then only it can be called a an independent platform. The platform-independent byte code is distributed through the web and is interpreted by the Virtual Machine (JVM) on any platform on which it is running.
- Architectural neutral;
The neutral object file format for the architecture is mainly generated by a Java compiler which makes compiled code executable on many processors, with the presence of the Java runtime system.
The architecture represents the processor.
It is said that a language or technology is architecturally neutral that can be run on any processor available in the real world without taking into account its development and compilation. Languages such as C, CPP are treated as architecture dependent.
Being neutral in terms of architecture and having no implementation-dependent aspects of the specification makes Java portable. The Java compiler is written in ANSI C with a clean portability limit, which is a POSIX subset.
Java programs are portable in operating systems and hardware environments.
Portability is to your advantage because:
- You only need one version of your software to serve a wide market.
- The Internet, in effect, becomes a giant and dynamic library.
- By your particular computer platform, you are no longer limited.
Three features make Java String programs portable:
- The language; The Java language is fully specified; All sizes and formats of data types are defined as part of the language. On the contrary, C / C ++ leaves these “details” to the compiler implementer, so many C / C ++ programs are not portable.
- The library; The Java class library is available on any machine with a Java runtime system, because a portable program is of no use if it cannot use the same class library on all platforms. Calls to the window manager function in a Mac application written in C / C ++, for example, do not behave well to a PC.
- The byte code; The Java runtime system does not compile its source code directly in machine language, an inflexible and non-portable representation of its program. Instead, Java programs are translated into machine-independent byte code. Byte code is easily interpreted and therefore can be executed on any platform that has a Java runtime system.
Multithreaded: With the Java multithreaded function, it is possible to write programs that can perform many tasks simultaneously. Developers can create interactive applications that can run smoothly and this is only allowed by its design feature.
Interpreted: The Java byte code is translated on the fly to the instructions of the native machine and is not stored anywhere. The faster and analytical process is development, since linking is an incremental and light process.
The Java language is safe because it is very difficult to write incorrect code or viruses that can corrupt / steal your data, or damage hardware such as hard drives.
There are two main lines of defense:
- Interpreter Level:
- Arithmetic without pointer
- Garbage collection
- Matrix Limits Check
- No conversions of illegal data
- Browser level (applies only to applets):
- There is no local I / O file
- Sockets again to accommodate only
- There are no calls to native methods.
The Java language is robust. Java strives to eliminate error-prone situations by emphasizing mainly the verification of errors at compile time and verification at runtime. It has several features designed to prevent blockages during program execution, which include:
- Arithmetic without pointer
- Garbage collection – no bad addresses
- Checking arrays and chains
- There are no jumps to addresses of bad methods.
- Interfaces and exceptions
Using this language, we can create distributed applications. RMI and EJB are used to create distributed applications. In the distributed application, the multi-client system depends on several server systems, so even the problem that occurred on one server will never be reflected on any client system.
It is designed primarily for web-based applications, J2EE is used to develop network-based applications.
It has high performance due to the following reasons;
- This language uses Bytecode, which is faster than the normal pointer code, so the performance of this language is high.
- The garbage collector collects unused memory space and improves application performance.
- It has no pointers so that by using this language we can develop an application very easily.
- It is compatible with multiprocessing, due to this time-consuming process can be reduced to program execution.
It is compatible with the concepts of OOP because it is the safest language, for this topic you can read the concepts of OOP in detail.
Java data types
The data type is a spatial keyword used to allocate enough memory space for the data, in other words, the data type is used to represent the data in the main memory (RAM) of the computer.
In general, each programming language contains three categories of data types which are;
Types of fundamental or primitive data;
The primitive data types are those whose variables allow us to store only one value, but never allow us to store multiple values of the same type. This is a type of data whose variable can contain a maximum of one value at a time.
Types of derived data;
The types of derived data are those whose variables allow us to store multiple values of the same type. But they never allow you to store multiple values of different types. These are the types of data whose variable can contain more than one value of a similar type. In general, the type of derived data can be achieved using an array.
User defined data types.
The types of user-defined data are those that are developed by programmers using the appropriate language features.
Variables related to user-defined data types allow us to store multiple values of the same or different type or both. This is a type of data whose variable can contain more than one value of a different type, in java it is achieved using the concept of class.
Java program structure
A file that contains the Java source code is considered a compilation unit. Compilation unit contains a set of classes and, optionally, a package definition for group related classes together. Classes contain data and method members that specify the status and behavior of objects in your program.
Java programs come in two flavors:
- Independent applications that have no initial context, such as a pre-existing main window
- Applets for WWW programming
The main differences between applications and applets are:
Applets cannot use file and socket I / O (except on the host platform). Applications do not have these restrictions. The subclass of the Java Applet class must be an applet. Applications do not need to sub classify any particular class.
Unlike applets, applications may have menus. Unlike applications, applets must respond to predefined life cycle messages from the WWW browser in which they run.
Object and class in Java
The object is the physical and logical entity, while class is the only logical entity.
Class: The class is a blue print that contains only a list of variables and methods and no memory is allocated for them. A class comprises of a group of objects which have common properties.
A class in java contains:
- Data member
- Class and interface
Object: The object is a class instance, the object has states and behaviors. An object in java has three characteristics:
- Status: represents data (value) of an object.
- Behavior: It actually signifies the behavior (functionality) of an object such as deposit, withdrawal, etc.
- Identity: The identity of the object is normally implemented through a unique ID. The ID value is not visible to the external user. However, JVM uses it internally to identify each object uniquely.
Array in java
Array is an ordered series of same types of data. Its fixed size means that you cannot increase the size of the array at runtime. It is a collection of homogeneous data elements. It stores the value based on the index value.
A variable can store several values: the main advantage of the matrix is that we can represent several values with the same name.
Code optimization: It is not necessary to declare a large number of variables of the same type of data. We can retrieve and sort the data easily.
Random access: we can retrieve any data from the array with the help of the index value.
Disadvantages of array
The main limitation of the array is the Size Limit when, once we declare the array, there is no possibility to increase and decrease the size of an array according to our requirements. Therefore, it is not recommended to use the concept of memory point of view array. To overcome this limitation in Java introduces the concept of collection.
There are two types of array in Java.
- One-dimensional matrix
- Multidimensional Array
Operators in Java
The operator is a special symbol that tells the compiler to perform a specific mathematical or logical operation. Java supports the following operator lists.
- Arithmetic operators
- Relational Operators
- Logical operators
- Bitwise Operators
- Assignment Operators
- Ternary or Conditional Operators
Decision making statement in Java
Decision making statements are also called selection statements. That depends on the condition that the block must be executed or not, which is decided by condition. If the condition is “true”, the instruction block will be executed, if the condition is “false”, then the instruction block will not be executed. There are three types of decision making statement in Java.
if-then is the most basic statement of the decision-making statement is if-then. It tells the program to execute a certain part of the code only if a particular condition is true.
In general, it can be used to execute an statement of block between two blocks, in java language if and if they are not the keyword in java.
The switch statement in java language is used to execute the code from multiple conditions or cases. It is the same as if else-if ladder statement. It mainly works with the data types of bytes, short characters, primitive characters and int, it also works with the enumerated types and strings.
How JAVA relates to C and C ++
Java is directly related to C and C ++. JAVA inherits its syntax from C. Its object model is adapted from C ++. The modern era of programming began with C. It moved to C ++ and in this present context, it is moved to JAVA.
One of the central design philosophies of C and C ++ is that the programmer is in charge. Java also inherits this philosophy. Java is not a language with training wheels. It is actually a language for professional programmers.
Java has another attribute in common with C and C ++, especially the support of both for object-oriented programming, it is tempting to think of JAVA as simply the Internet version of C ++. Although, Java was influenced by C ++, it is not an improved version of C ++.
Java’s contribution to the internet.
Java had a profound effect on the internet as the internet facilitated catapult Java to the forefront of programming. Java innovated a new type of network program called the applet in order to simplify web programming that changed the way the online world had access to content. Java also addressed some of the most thorny problems associated with the Internet; Portability and security.
Java applets is used to be transmitted over the Internet and spontaneously executed by a Java-compatible web browser. In addition, an applet is downloaded on demand, without further interaction with the user. Java solved the security and portability issue in an effective and elegant way.
Java achieved protection by limiting an applet to the Java execution environment and not allowing access to other parts of the computer. Many believe that the ability to download applets with the certainty that there will be no damage and that security will not be violated is the most innovative aspect of Java.
Portability is an important aspect of the Internet because there are many different types of computers and operating systems connected to it. If a Java program runs on virtually any computer connected to the Internet, there should be some way to allow that program to run on different systems.
The magic of java; The bytecode
The key that allows Java to solve both security and portability problems is that the output of a Java compiler is not an executable code. Rather, it is bytecode. Bytecode is a highly optimized set of instructions designed to be executed by the Java runtime system, which is called the Jaa Virtual Machine (JVM).
The conversion of a Java program into a byte code makes it much easier to run a program in a wide variety of environments, since you only need to implement the JVM for each platform.