java is great programming language for the development of enterprise grade applications

Upload: jairadh786

Post on 30-May-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Java is Great Programming Language for the Development of Enterprise Grade Applications

    1/8

    Java is great programming language for the development of enterprise grade applications.This programming Language is evolved from a language named Oak. Oak was developed in

    the early nineties at Sun Microsystems as a platform-independent language aimed at allowing

    entertainment appliances such as video game consoles and VCRs to communicate . Oak wasfirst slated to appear in television set-top boxes designed to provide video-on-demand

    services. Oak was unsuccessful so in 1995 Sun changed the name to Java and modified thelanguage to take advantage of the burgeoning World Wide Web.

    Java is an object-oriented language, and this is very similar to C++. Java ProgrammingLanguage is simplified to eliminate language features that cause common programming errors.

    Java source code files are compiled into a format called bytecode, which can then be executed

    by a Java interpreter.

    New to

    programming...

    Else a classical programmer !No more fear of pointers...Break the old rhythm.

    Explore the new

    horizons.

    Be a crew member to the

    new Ship...

    After decades of R & D's, the real life

    programming is here....having no space for complexities.

    Think before you jump...

    Upper

    edge

    with java...

    # Be platform independent , have control to the widest

    range of gadgets with java.....from mobile phones ,

    computers, washing machines, refrigerators , satellites,

    cars...........# Ensure quality through java as it is least prone to errors

    due to its superb error handling mechanism.

    # Block the intruders as Java is least prone to viruses being

    strictly a typed language.

    # Be International and go global with java as it is highly

    suited to internet environment.

    http://www.roseindia.net/java/http://www.roseindia.net/java/
  • 8/9/2019 Java is Great Programming Language for the Development of Enterprise Grade Applications

    2/8

    # Be a real life programmer with java as it is Object

    Oriented.

    # Develop applications in all spheres with java :

    stand alone applications like games, desktop

    publications Enterprise applications dealing with finance, defense ,

    insurance, banks...

    Embedded applications used in automated systems,

    robots , flying machines...

    Micro Device applications used in cell phones, PDAs, TV

    set-top boxes...

    # Be a self starter with Java as it is easy to learn & simple to

    develop applications with.

    # Java is always a fun to develop with. Just Imagine and get

    it done in JAVA.

    Alert : Learn Hunting from

    Hunters

    Java initially requires a lot of efforts to learn and master . Here

    at RoseIndia.Net, we have developed hundreds of tutorials,

    examples and articles to help you learn Java quickly and easily.

    We have tried to put supporting examples related to each Java

    technology that will help you master the concepts. These tutorials

    and examples are arranged in a sequence, so that you can learnJava step by step and master the Java and JEE technologies.

    Nut-Bolts of Java:

    a) Java SE - Java SE ( Java Standard Edition ) provides tools

    and API's to create diverse applications. Applications

    developed with Java SE are supported by every operating

    system, including Linux, Macintosh, Solaris, and Windows.

    b) Java EE -Java Enterprise Edition specifications based on the

    foundation framework of the standard edition. Java Enterprise

    Edition are the specifications needed to service the multi-tiered

    environment, to support the enterprise class service oriented

    architecture (SOA) and a lot...............

  • 8/9/2019 Java is Great Programming Language for the Development of Enterprise Grade Applications

    3/8

    c) Java ME - Java Micro Edition is an accumulation of Java

    APIs used to develop micro-devices applications like mobile

    phones, PDAs, TV set-top boxes, game programming. The

    platform of micro edition generally consists of an easy user

    interface, a robust security model and a wide variety of built-in

    networks for running Java based application.

    Now its time to explore the JAVA Horizonswith ROSEINDIA.Relax....buddy.. untie your

    seat belts...You are landing in the comfortzone....click to explore

    An object is the combination of related states and behavior in which variables are just like

    states and the methods are just like behaviors (providing some functionality). In an object,

    variables store values for later use and methods are the unit of codes that provides a particularfunctionality. We can say objects are the basic units of the object-oriented programming.

    Objects are the part of our day to day life, these are the real world entities around us.

    Technology, records, human beings, and even the implemented concepts all are the examples

    of objects. For instance, A CEO of any company can take a view of his company's policies,employees, buildings, records, and beneficial packages as the objects. Similarly a software

    developerdoes analysis, designing, coding, testing and also looks for the future scope of that

    project as objects. Even a toy is an object for a child.

    Real-world objects share two characteristics: They all have state and behavior.

    For instance Lions have state (name, color, breed, hungry) and behavior (roaring, fetching

    etc). Cars also have state (current gear, current speed) and behavior (changing gear, changingspeed, applying brakes). Identifying the state and behavior for real-world objects is a great

    way to begin thinking in terms of object-oriented programming. Objects are key to

    understanding object-oriented programming. Just look around and you'll find a lot of examplesof real-world objects: cat, desk, television set, car, pen etc.

    Here is an additional information about Objects that we can create multiple objects in any

    single java application to perform many task like implementing a GUI, any operation oninformation and many more.

    Car myCar = new Car();

    If we consider above example of car then if we need to create a new car, we have to make a

    new instance or an object by using the newkeyword. The constructor is responsible for settingup the initial state of an object. Instead of declaring an object, a constructor is called

    automatically when the new keyword is used.

    http://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/objects.shtml
  • 8/9/2019 Java is Great Programming Language for the Development of Enterprise Grade Applications

    4/8

    A simple example of constructing an object is given below:

    Here is the Code of the Example :

    Classtest.java

    import java.lang.*;

    public class Vehicle{

    public static voidmain(String args[])

    {

    Car myCar = new Car();

    myCar.display();

    }

    }

    class Car{

    public voiddisplay(){

    System.out.println("\nIt's a example of car");

    }

    }

    Here is the Output of the Example :

    C:\roseindia>javac Vehicle.java

    C:\roseindia>java Vehicle

    It's a example of car

    Nested Classes

    Here is another advantage of the Java, an object-oriented programming language that allows

    us to define a class within another class, such classes are known as nested classes. Inner

    classes can be either named or anonymous. We'll discuss about anonymous classes later in this

    section. A named inner class looks just like any other class, except that it is nested insideanother class. ( It can even contain further levels of nested classes, but you shouldn't carry

    these things too far ).

    Like the members of a class, a named inner class can be either static or non-static. A staticnested class is part of the static structure of the containing class. It can be used inside a class

    that is used to create objects in the usual way. If it has not been declared private, then it can

    also be used outside the containing class, but when it is used outside the class, its name must

    http://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/nested.shtmlhttp://www.roseindia.net/java/master-java/objects.shtmlhttp://www.roseindia.net/java/master-java/nested.shtml
  • 8/9/2019 Java is Great Programming Language for the Development of Enterprise Grade Applications

    5/8

    indicate its membership in the containing class. This is similar to other static components of a

    class: A static nested class is part of the class itself in the same way as static member variables

    are the part of the class itself.

    A simple nested class example is given below:

    class OuterClass {...expression...

    class NestedClass {

    ...expression...}

    }

    A static nested class has full access to the members of the containing class, even to the private

    members. This can be another motivation for declaring a nested class, since it lets a class togain access to the private members of another class without making those members generally

    available to other classes.

    There are two categories of nested classes, which are as under:

    i) Static classes

    ii) Inner classes (Non-static)

    Static Nested Classes

    A nested class that is declared static is called a static nested class. Memory to the objects ofany static nested classes are allocated independently of any particular outer class object. A

    static nested class use the instance variables or methods defined in its enclosing class only

    through an object reference. A static nested class interacts with the instance members of itsouter class or any other class just like a top-level class.

    Given below is the syntax of the Static nested class that defines static nested class having

    keyword static in the outer class.

    class OuterClass {

    ....static class

    StaticNestedClass {

    ....}

    class InnerClass {

    .... }

    }

    Static nested classes can be accessed by using the enclosing class name:

    OuterClass.StaticNestedClass

    If we want to make an object of the static nested class then we have to write down the

    following code:

    OuterClass.StaticNestedClass nestedObject = new

    OuterClass.StaticNestedClass();

    http://www.roseindia.net/java/master-java/Static.shtmlhttp://www.roseindia.net/java/master-java/inner.shtmlhttp://www.roseindia.net/java/master-java/Static.shtmlhttp://www.roseindia.net/java/master-java/Static.shtmlhttp://www.roseindia.net/java/master-java/inner.shtmlhttp://www.roseindia.net/java/master-java/Static.shtml
  • 8/9/2019 Java is Great Programming Language for the Development of Enterprise Grade Applications

    6/8

    Here is an example of the Static nested class that processes of accessing the instance of the

    outer class inside the inner class. The example creates an "Outer" class with an instance x of

    value 100 and after that we call this value in inner class method check. Apart from that theexample also creates another function check and call the inner class check() method inside it.

    When the example calls the check() with Outer class, it shows the value of Outer class

    instance x.Here is the code of the Example :

    Outer.java

    import java.lang.*;

    public class Outer{

    int x = 100;

    class Inner{

    int x = 200;

    public voidcheck(){

    System.out.println("Value of x is: "+ Outer.this.x );

    }

    }

    public voidcheck(){

    new Inner().check();

    }

    public static voidmain(String args[]){

    new Outer().check();

    }

    }

    Here is the output of the Example :

    C:\roseindia>javac

    Outer.java

    C:\roseindia>java Outer

    Value of x is: 100

    http://www.roseindia.net/java/master-java/Static.shtmlhttp://www.roseindia.net/java/master-java/Static.shtmlhttp://www.roseindia.net/java/master-java/Static.shtmlhttp://www.roseindia.net/java/master-java/Static.shtml
  • 8/9/2019 Java is Great Programming Language for the Development of Enterprise Grade Applications

    7/8

    Inner Nested Classes

    Non-static nested classes are slightly different from static nested classes, a non-static nested

    class is actually associated to an object rather than to the class in which it is nested.

    Any member of the inner nested class is not a part of its outer class while its source code is in

    the class definition. Non-static members of a class specify the requirements of objects createdfrom that class. Every object has a copy of the nested class that belongs to the outer class. The

    same copy should access all the methods and instance variables of that object.

    Methods and variables of an inner class can be access directly by the object of outer class. Thefigure given below illustrates it logically.

    Lets try to explain the concept of inner nested class with the help of an example. There is an

    inner class company exists within an outer class Info. The class Info is to be referred as non-

    static nested class. The class Info invokes the method of the class Company with the help ofthe object of the class Company.

    Here is the code of the Example :

    Info.java

    import java.lang.*;

    public class Info{

    static String compName="Rose India";

    public static class Company{

    int time=10;

    voidshowinfo(){

    System.out.println("Our Company Name : "+compName);

    System.out.println("The time of the company : "+time);

    }

    }

    public static voidmain(String[] args){

    Info.Company object = new Info.Company();

    object.showinfo();

    }

    }

    Here is the output of the Example :

    C:\roseindia>javac

    Info.java

    http://www.roseindia.net/java/master-java/inner.shtmlhttp://www.roseindia.net/java/master-java/inner.shtmlhttp://www.roseindia.net/java/master-java/inner.shtmlhttp://www.roseindia.net/java/master-java/inner.shtml
  • 8/9/2019 Java is Great Programming Language for the Development of Enterprise Grade Applications

    8/8

    C:\roseindia>java Info

    Our Company Name : Rose

    India

    The time of the company :

    10