Pages

Monday, 15 February 2016

Core Java


Java Evolution


Java History



• Java is a general purpose , object-oriented programming language.
• The fastest growing programming language in the history of computing
• Developed by Sun Microsystems of USA in 1991.
• Originally it is called Oak by James Gosling.
• Originally designed in 1991 for use in embedded consumer applications
• Java team which headed James Gosling developed a Web browser called “Hot Java” to
locate and run applet programs on Internet in 1994.
• Oak was renamed “Java” in 1995. 
• Redesigned in early 1995 with Internet application capabilities
• Introduced in May, 1995 and immediately supported by the Netscape Web browser.
• Rapidly overtaking C++ in popularity among commercial software developers
• Java established itself not only as a leader for Internet programming but also as a
general purpose, object-oriented programming language.
• Java found its home in the heart of the modern programmer.
• Java is the first programming language that is not tied to any particular hardware or
operating system.
• Programs developed in java can be executed anywhere on any system.
• Therefore Java comes as a revolutionary technology because it has brought in a
fundamental shift in how we develop and use programs.


Java Features:

• Simple • Architecture-neutral  
• Object-oriented  • Portable 
• Distributed • High-performance 
• Interpreted • Multithreaded 
• Robust • Dynamic 
• Secure 
Simple: 
       Java is a simple language as it does not use pointers, preprocessor header files; go to statement and many more others. 
Object oriented: 
       In Java everything is object. All program code and data within objects and classes. 
Distributed: 
       Java is designed as a distributed language for creating applications on networks. It has ability to share both data and programs. 
Interpreted: 
       Interpreting means actually compiling the program line by line and generates the machine code. Java interpreter generates machine code that can be directly executed by the machine is that running the Java program. 
Robust: 
       Java is a robust language as it provides many safeguards to ensure reliable code. It has strict compile time and run time checking for data types. 
Secure: 
       No viruses can affect the Java program as Java ensures that program cannot gain access to memory locations without proper authorization. Java systems not only verify all memory access but also ensure that no viruses are communicated with an applet. 
Architecture-neutral: 
       In Java, changes and upgrade in operating system, processors and system resources will not force any changes in Java programs. 
Portable: 
       Java programs can be easily moved from one computer system to another, anytime, and anywhere. Java ensures portability in two ways. First, Java compiler generates bytecode instructions that can be implemented on any machin. Secondly the sizes of the primitive data type are machin-independent. 
High-performance: 
       Java performance is impressive for an interpreted language , mainly due to the use of intermediate bytecode. 
Multithreaded: 
       Java support multithreaded programs means handling multiple task simultaneously. 
Dynamic: 
       Java is capable of dynamically linking in new class libraries, methods and objects. 

Benefits of Java over C and C++ 
• Architecturally neutral. Once written, the same Java program can be run on any   
platform computer and operating system) that supports Java.
• Entirely object-oriented. Existing code can be easily re-used and maintained.
• Secure. Dangerous program actions are prohibited. 
• Supports Internet programming. Java applets are run by Web browsers.
• Robust. Language features and packaged code support graphical programming,   

exception handling, networking, multi-threading, I/O, and more.

How Java works
• To develop and distribute a Java program  
1. Programmer codes Java source statements 
2. Java compiler converts source statements into bytecode (platform-independent object     language)  
3. Bytecode is copied to the target platform 
• To execute a Java program  
1. Platform-dependent Java Virtual Machine (JVM) software must be installed  
2. A copy of the JVM is started  
3. Each bytecode statement is interpreted (translated) by the JVM into platform-dependent     machine language and executed under JVM control.
Java has two things: a programming language and a platform.

The Java Programming Language
Java is a high-level programming language that is all of the following:
• Simple• Architecture-neutral
• Object-oriented• Portable
• Distributed• High-performance
• Interpreted• Multithreaded
• Robust• Dynamic
• Secure
Java is also unusual in that each Java program is both compiled and interpreted.
With a compiler, it translates a Java program into an intermediate language called Java bytecodes--the platform-independent codes interpreted by the Java interpreter.

With an interpreter, each Java bytecode instruction is parsed and run on the computer. Compilation happens just once; interpretation occurs each time the program is executed. This figure show how it works.
The Java bytecodes is the machine code instructions for the Java Virtual Machine (Java VM). Every Java interpreter, whether it's a Java development tool or a Web browser that can run Java applets, is an implementation of the Java VM. The Java VM can also be implemented in hardware.

Java bytecodes help make "write once, run anywhere" possible.

One can compile your Java program into bytecodes on any platform that has a Java compiler. The bytecodes can then be run on any implementation of the Java VM.

The Java Platform
A platform is the hardware or software environment in which a program runs. The Java
platform differs from most other platforms in that it's a software-only platform that runs on
top of other, hardware-based platforms. Most other platforms are described as a combination of hardware and operating system.
 The Java platform has two components:
• The Java Virtual Machine (Java VM)
• The Java Application Programming Interface (Java API)
The Java VM is the base for the Java platform and is ported onto various hardware-based platforms.
The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets. The Java API (application programming interface) is grouped into libraries (packages) of related components.


Java Development Kit
The Java Development Kit comes with a collection of tools that are used for developing and running Java programs. They include:
• appletviewer ( for viewing Java applet)
• javac (Java compiler)
• java (Java Interpreter)
• javap (Java disassembler)
• javah (for C header files)
• javadoc (for creating HTML documents)
• jdb (Java debugger)
The below figure depicts a Java program, such as an application or applet, that's running on the Java platform. As the figure shows, the Java API and Virtual Machine insulates the Java program from hardware dependencies.


HARDWARE AND SOFTWARE REQUIREMENTS
Java is currently supported on Window 95, Window NT, Sun Solaries, Macintosh and UNIX machine.
The minimum software and hardware requirement for 95 version of Java are as follows:
     • IBM-compatible 486 system
     • Minimum of 8 MB memory
     • Windows 95 software
     • A Windows-compatible sound card
     • A hard drive;
     • A CD-ROM drive
     • A Microsoft-compatible mouse


Disadvantages of Java
• Not supported by all platforms (though third-party JVM software is usually available)
• Slower in execution than compiled languages
• Restricts or prohibits machine-level operations required by certain applications    (operating systems, etc.)
                                                                                                            
Overview of Java Language


Constant,Variable and Datatypes


Operator and Expressions
Decision making ,branching and looping
Class, Object and Method
Arrays and Strings
Inheritance
Packagee
Multithreading
Exceptional Handling
Applet
Managing Input/Output file in Java

No comments:

Post a Comment