Introduction to Java
Introduction to Java
Java is a general purpose programming language, it is multi-threaded, class-based, object-oriented and strongly-typed. It was intended to be written once and run anywhere, Sun Microsystems’ motto was “Write Once, Run Anywhere” because once compiled into bytecode, runs on all platforms that support the JVM (Java Virtual Machine) without any need to be recompiled using the native Operating System’s compilers as was the case for other languages such as C and C++.
What’s Covered
- History of Java
- Java Official Release
- Java Features and Language Properties
- Java is a Object Oriented Language
- Java is a Strongly-Typed Language
- Java is Robust
- Java is Platform Independent
- Java is Compiled and Interpreted
- Java has Memory Management
- Java is Multi-threaded
History of Java
The history of Java actually began with a different name and much different purpose in mind. James Gosling, Patrick Naughton and a team of developers were working on a TV set top box project at Sun Microsystems using C++ had become increasingly frustrated with it.
Gosling decided come up with a language that addressed some of the frustrations and perceived short-comings of C++ that could be used in this project. Originally called OAK after an oak tree that was outisde of Gosling’s office. Its name was later changed to Green and was finally renamed to Java.
Ultimately the TV set-top box flopped, but they now had a language that could be used for the next big thing that was beginning to take off: the Internet.
Java Official Release
Java 1.0 was released to the public in 1995. It was quite primitive compared with today’s versions of Java and languages like C and C++. BUt it did support applets which could be embedded into Web pages and run on the most popular browser at the time, Netscape Navigator written by Marc Andreesen.
It was the first programming language that allowed web pages to be truly interactive and as such drew such a fan following that hundreds of thousands of programmers flocked to learn Java in a first few months of the language’s release.
Although Java could run inside browsers as applets, it became increasingly popular outside of browsers.
Java Features and Language Properties
Java is a Object Oriented Language
Java is comprised of objects, classes, inheritance, interfaces, and packages. Java objects are used to model “real” or “physical” world objects based on certain characteristics you would like to take into account and are created by using templates called classes.
Java is a Strongly-Typed Language
In Java, every variable must be declared and associated with a specific type. A variable may not be declared without knowing the values that it may contain. Additionally, once a variable is declared you are not allowed to change it.
Java is Robust
Java put a lot of emphasis on ensuring that errors and bugs are caught as early as possible. Java’s compiler is able to detect many problems early to ensure that they are corrected prior to execution. In addition to its vast compile time checking and runtime checking, it provides powerful exception handling, and strong type checking to prevent hard to catch bugs as compared to other languages. Java also performs automatic memory management and garbage collection to ensure that memory that is no longer used can b reclaimed. All of these features makes the language robust.
Java is Platform Independent
Platform independence is the ability of a program to run in different computing environments without the need to be recompiled in that environment. Java is compiled into Bytecode that can run on any computing device that contains a Java Virtual Machine (JVM).
Java is Compiled and Interpreted
Java is compiled into bytecode which can run on any machine that has a Java Virtual Machine (JVM). These bytecodes are interpreted by the JVM when the program is running. However, JVM’s may use JIT (Just-In-Time) compilers to perform optimizations like inlining functions that are commonly used or convert some of this bytecode into native instruction set to improve system performance.
Java has Memory Management
Java Memory Management and built in garbage collection is one of the languages hallmark features. It gives the developers the freedom to create objects without having to worry about allocating and deallocating space as the garbage collector takes care of reclaiming memory from unused or out-of-scope variables.
Java is Multi-threaded
Java allows us to create applications that are multi-threaded. The Java Virtual Machine support multiple threads running concurrently within the same process. Programs that run more than one task at any time are said to be multithreaded. Multithreading allows multiple threads to exist and execute simultaneously within the context of a single process. It will allow for multiple tasks to execute on multiprocessor systems. This, in turn makes better utilization of CPU resources and makes programs appear much more responsive.
Core Java Related Tutorials
- Base64 Encoding and Decoding Examples in Java 8
In this tutorial we will discuss how to Encode and Decode using Base64 using Java 8, which now finally has native Base64 support. - Base64 Encoding and Decoding Examples in Java using Google Guava
This tutorial will introduce how to Encode and Decode using Base64 using Google’s Guava Project Open Source library. - Base64 Encoding and Decoding Examples in Java using Apache Commons
This tutorial will introduce Base64 encoding and decoding examples using the Apache Commons Codec library. - Custom Number Formatting in Java
In this example we will show you how to use the NumberFormat and DecimalFormat classes to format numbers using special patterns. - Custom Date Formatting in Java
In this example we will show you how to use the SimpleDateFormat class to format Date objects using special patterns to better fit the needs of the application.
Leave a Reply