Java Programing laungage

Core Java Tutorial

Introduction of Core Java

How To Install JDk and Set of Path

Syntax of java Program

Difference between Java and C/C++

Advantage and Disadvantage of Java

What is Java

Why Java is not Pure Object Oriented Language

Java has Following Features/Characteristics

Limitation of Java Language and Java Internet

Common Misconception about Java

Simple Program of Java

Integrated Development Environment in java

Compile and Run Java Program

Applet and Comments in Java

Tokens in Java

Keywords in Java

Identifier and Variables in Java

Literals/Constants

Data Type in Java

Assignments and Initialization in Java

Operators in Java

Rule of Precedence in Java

Operator on Integer and Separators in Java Programming

Java Control Flow of Statements

If and If-else Selection Statement

Nested If-else and If-else-If Selection Statement

switch case and conditional operator Selection Statement

for and while Loop

do..while and for each Loop

break and labeled break statement

continue and labeled continue statement

return Statement and exit() Method

Escape Sequence for Special Characters and Unicode Code

Constants and Block or Scope

Statement in Java

Conversions between Numeric Types in Java

Import Statement in Java

User Input in Java using Scanner Class

User Input in Java using Console Class

Array in Java

One Dimensional Array

Two Dimensional Array

Two Dimensional Array Program

Command Line Argument in Java

String args Types in Java

Uneven/Jagged array in java

Math Class Function and Constant

Math Class all Function used in a program

Enumerated Types in Java

Object Oriented Programming v/s Procedural Programming

Object Oriented Programming Concepts in Java

Introduction to Class,Object and Method in Java

Class Declaration in Java

Class & Objects in java

Encapsulation in Java

Modifiers/Visibility for a Class or Interrface or member of a Class

Polymorphism in Java

Runtime polymorphism (dynamic binding or method overriding)

adplus-dvertising
Difference between jdk1.4 and jdk1.5
Previous Home Next

Java 2 Platform Standard Edition 5.0 is a major feature release. The features listed below are introduced in 5.0 since the previous major release (1.4.0).

  1. Generics: provides compile-time type safety for collections and eliminates the need for most type conversion.

    Here is an example how we can use generics in our code.

    
    old syntax
    List myList = new ArrayList();
    new syntax
    List<String> myList = new ArrayList<String>();
    
    
  2. Enhanced for Loop: The for loop syntax is extended with special syntax for iterating over each member of either an array or any iterable collection.

    Here is an example how we can use enhanced for loop in our code.

    
    //old syntax
     String[] myStrings = new String[10];
    for(int i=0; i<10; i++)
    {
    myStrings[i] = "Count " + i;
    }
    //new syntax
     String[] myStrings = new String[10];
    for(String str : myStrings)
    {
    str = "Count " + i;
    }
    
    
  3. Autoboxing/Unboxing: Automatic conversions between primitive types (such as int) and primitive wrapper classes (such as integer).

    Here is an example how autoboxing/unboxing works

    
    List<Integer> myIntList = new ArrayList<Integer>();
    int maxNumber = 10;
    myIntList.add(maxNumber);
    
    

    If you notice here myIntList is accept only Integer objects, but here we can add int primitive type variable as well. it internally converts int(primitive type) to Wrapper class(Integer), Its called Autoboxing.

    
    int minNumber = myIntList.get(0);
    
    
  4. Static Import: This facility lets you avoid qualifying static members with class names without the shortcomings of the "Constant Interface anti-pattern."

    Suppose you want to use DATE constant from the Calender class in your code at multiple places then you have to first import the Calender class in your program using.

    
    import java.util.Calendar;
    
    
  5. Metadata (Annotations): This language feature lets you avoid writing boilerplate code under many circumstances by enabling tools to generate it from annotations in the source code. This leads to a "declarative" programming style where the programmer says what should be done and tools emit the code to do it. Also it eliminates the need for maintaining "side files" that must be kept up to date with changes in source files. Instead the information can be maintained in the source file.

    There are so many annotation you can use in your program like @Before, @BeforeClass, @Override, @Deprecated, @Test etc.

  6. Enumerations: The enum keyword creates a typesafe, ordered list of values (such as day.monday, day.tuesday, etc.). Previously this could only be achieved by non-typesafe constant integers or manually constructed classes.

    
    public enum Day {
    SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
    THURSDAY, FRIDAY, SATURDAY
    }
    
    
  7. Varargs: In past releases, a method that took an arbitrary number of values required you to create an array and put the values into the array prior to invoking the method.

    Example, Here is how one used the MessageFormat class to format a message:

    
     Object[] arguments = {
    new Integer(7),
    new Date(),
    "a disturbance in the Force"
    };
    String result = MessageFormat.format(
    "At {1,time} on {1,date}, there was {2} on planet "
    + "{0,number,integer}.", arguments);
    
    
  8. Concurrent API: concurrency utilities in package java.util.concurrent. like ConcurrentHashMap,ConcurrentLinkedQueue etc.

  9. StringBuilder class: StringBuilder class (in java.lang package).

Previous Home Next