Welcome to Edukum.com

An Overview of Java

Data Types, Variables and Arrays


Control Statements

Introducing Classes

A Closer Look at Methods and Classes


Exception Handling

Multi-threaded Programming

Enumerations, Auto-boxing and Annotations

String Handing


Java Development Environment

Java Development Environment
James Gosling initiated the Java language project in June 1991 for use in one of his many set-top box projects. The language, initially called Oak after an oak tree that stood outside Gosling's office, also went by the name Green and ended up later being renamed as Java, from a list of random words. Sun Micro system released the first public implementation as Java 1.0 in 1995. It promised Write Once, Run Anywhere (WORA), providing no-cost run-times on popular platforms. On 13 November 2006, Sun released much of Java as free and open source software under the terms of the GNU General Public License (GPL). On 8 May 2007, Sun finished the process, making all of Java's core code free and open-source, aside from a small portion of code to which Sun did not hold the copyright.
JAVA features
  1. Simple
    • Java easy to learn.
    • It is easy to write programs using Java.
    • Most of the complex or confusing features in C++ are removed in Java like pointers etc.
  2. Secure
    • Java provides data security through encapsulation.
    • Also, we can write applets in Java which provides security.
    • An Applet is a small program which can be downloaded from one computer to another automatically.
    • There is no need to worry about applets accessing the system resources which may compromise security.
    • Applets are run within the JVM which protects from unauthorized or illegal access to system resources.
  3. Portable
    • Applications written using Java are portable in the sense that they can be executed on any kind of computer containing any CPU or any operating system.
    • When an application written in Java is compiled, it generates an intermediate code file called as “bytecode”.
    • Bytecode helps Java to achieve portability.
    • This bytecode can be taken to any computer and executed directly.
  4. Object - Oriented
    • Java follows object oriented model.
    • So, it supports all the features of object oriented model like: Encapsulation, polymorphism, abstraction and inheritance.
  5. Robust
    • A program or an application is said to be robust (reliable) when it is able to give some response in any kind of context.
    • Java’s features help to make the programs robust. Some of those features are
    • Type checking
    • Exception handling
  6. Multithreaded
    • Java supports multi threading which is not supported by C and C++.
    • A thread is a light weight process.
    • Multi threading increases CPU efficiency.
    • A program can be divided into several threads and each thread can be executed concurrently or in parallel with the other threads.
    • Real world example for multi threading is computer. While we are listening to music, at the same time we can write in a word document or play a game.
  7. Architecture - Neutral
    • Bytecode helps Java to achieve portability.
    • Bytecode can be executed on computers having any kind of operating system or any kind of CPU.
    • Since Java applications can run on any kind of CPU, Java is architecture – neutral.
  8. Interpreted and high performance
    • In Java 1.0 version there is an interpreter for executing the bytecode. As interpreter is quite slow when compared to a compiler, java programs used to execute slowly.
    • After Java 1.0 version the interpreter was replaced with JIT (Just-In-Time) compiler.
    • JIT compiler converts the byte code into machine code piece by piece and caches them for future use.
    • This enhances the program performance means it executes rapidly.
  9. Distributed
    • Java supports distributed computation using Remote Method Invocation (RMI) concept.
    • The server and client(s) can communicate with another and the computations can be divided among several computers which makes the programs to execute rapidly.
    • In distributed systems, resources are shared.
  10. Dynamic
    • The Java Virtual Machine (JVM) maintains a lot of run time information about the program and the objects in the program.
    • Libraries are dynamically linked during run time.
    • So, even if you make dynamic changes to pieces of code, the program is not affected.
Java platform
The two most important components of the Java Platform are the Java Runtime Environment (JRE) and the Java Development Kit (JDK). When installed on a computer the JRE provides the operating system with the means to run Java programs, whereas the JDK is a collection of tools used by a programmer to create Java applications. The Java platform editions contain additional Java APIs for creating different types of applications:
  1. JAVA Standard Edition
    The Java Standard Edition (Java SE) is for building desktop applications and applets. These applications typically serve only a small number of users at one time.
  2. JAVA Enterprise Edition
    The Java Enterprise Edition (Java EE) is tailored for more complex applications to suit medium to large businesses. Typically they will be server based applications focusing on serving the needs of lots users at one time. Note:The Java EE contains many of the Java APLs found in the Java SE.
  3. JAVA Micro Edition
    The Java Micro Edition (Java ME) is for applications used on mobile (e.g., cell phone, PDA) and embedded devices (e.g., TV tuner box, printers).
JVM and Bytecode
A Java virtual machine (JVM), an implementation of the Java Virtual Machine Specification, interprets compiled Java binary code (called bytecode) for a computer's processor (or "hardware platform") so that it can perform a Java program's instructions.Java was designed to allow application programs to be built that could be run on any platform without having to be rewritten or recompiled by the programmer for each separate platform.
Bytecode is the compiled format for Java programs.Once a Java program has been converted to bytecode, it can be transferred across a network and executed by Java Virtual Machine (JVM). Bytecode files generally have a .class extension.
Java Tools
  • javac: The compiler for the Java programming language.
  • java: The launcher for Java applications. In this release, a single launcher is used both for development and deployment. The old deployment launcher, jre, is no longer provided.
  • javap: Class file disassembler. Its output depends on the options used. If no options are used, javap prints out the package, protected, and public fields and methods of the classes passed to it.
  • javadoc: It is a documentation generator from Oracle Corporation for generating API documentation in HTML format from Java source code. The HTML format is used to add the convenience of being able to hyperlink related documents together.
  • appletviewer: The appletviewer command allows you to run applets outside of a web browser.


#Things To Remember