by Dinesh Thakur Category: Introduction to Java

Java is the object oriented, similar to C++ high-level programming language and architecture neutral developed by Sun Microsystems. Java was originally called OAK. Object Oriented meaning the capability to reuse code. Secondly, it is platform independent i.e. we don't have to develop separate applications for different platforms. It is possible to develop a single application which can run on multiple platforms like Windows, UNIX, and Macintosh systems. Java was designed for hand-held devices and set-top boxes.

 
by Dinesh Thakur Category: Introduction to Java

The different languages reflect the different styles of programming. Procedural programming decomposes a program into various different functional units, each of which can gather and manipulate data as needed.

 
by Dinesh Thakur Category: Introduction to Java

Inheritance is a compile-time mechanism in Java that allows you to extend a class (called the base class or superclass) with another class (called the derived class or subclass). In Java,inheritance is used for two purposes:

 
by Dinesh Thakur Category: Introduction to Java

Initializing a variable is considered very helpful while making programs. We can initialize variables of primitive types at the time of their declarations. For example:

 
by Dinesh Thakur Category: Introduction to Java

'this' pointer is used when a method has to refer to an object that has invoked it. 'this' pointer can be used inside any method to refer to the current object. This means that this is always used as a reference to the object on which the method was invoked. We can use this anywhere as reference to an object of the current class type is permitted. Since, it is illegal in Java to declare two local variables with the same name inside the same or enclosing scopes; we can have local variables, which include formal parameters to methods, which may overlap with the names of the class instance variables. However, when a local variable has the same name as an instance variable, the local variable hides the instance variable.

 
by Dinesh Thakur Category: Introduction to Java

In this Example we Reading amount, Year and interest in the class Scanner becomes analogous to reading string. In this example, the three numbers are read from the console, and then perform Simple Interest,Compound Interest operations and results printed on the screen in formatted output.

 
by Dinesh Thakur Category: Introduction to Java

Enumeration (enum) was not originally available in Java though it was available in other language like C and C++ but eventually Java realized and introduced Enum on JDK 5 (Tiger) by keyword enum

 
by Dinesh Thakur Category: Introduction to Java

The RMI architecture, shown in Figure, describes how remote objects behave and how parameters are passed between remote methods. Remote method invocation allows the program to define separately the behaviour and the code that implements the behaviour and allows running them on separate JVMs. This principle facilitates the clients to focus on the definition of a service while the servers can focus on providing the service.

 
by Dinesh Thakur Category: Introduction to Java

Polymorphism gives us the ultimate flexibility in extensibility. The abiltiy to define more than one function with the same name is called Polymorphism. In java,c++ there are two type of polymorphism:



 
by Dinesh Thakur Category: Introduction to Java

Modifiers are keywords used to define the scope and behaviour of classes, methods and variables in Java. Access modifiers specified who can access them. Java has a wide variety of modifiers that can be categorized as shown below:

 

Page 1 of 3