by Dinesh Thakur

In this section, we will see the implementation of a simplified version of linked list class provided by the Java library. This shows how the lists of operations manipulate the links when the list is modified.



 
by Dinesh Thakur

You've probably used a computer for work or leisure. Many people use computers for everyday tasks such as check the bank balance or write a school report. Computers are good for these tasks. They can treat repetitive tasks, such as adding numbers or insert words on a page without getting bored or exhausted. Computers are also good for games because they can play sequences of sounds and images, involving the human user in the process.



 
by Dinesh Thakur

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

The Java RMI comes along with Java JDK l.l and higher versions. It is a true distributed computing application interface for Java. Java RMI is language-specific, and can provide more advanced features like serialization, security and so on.



 
by Dinesh Thakur

Applet: A small program for specific functions, which usually come with the operating system. Examples in Windows are Paint and Notepad. On a Macintosh, examples are Calculator and Scrapbook. The name comes from the term "applications" which is one variety of a software program.



 
by Dinesh Thakur

We will now make a small program that will input two integers in Java and display their sum. In this program, we will use the methods available in Scanner class to read data typed at keyboard and place it into variables that we specify.



 
by Dinesh Thakur

Our first program is composed of three logical parts :

1. Definition of the class;
2. Definition of the method main ();
3. Content of the method main ().

 
by Dinesh Thakur

In the Following Java Example, shows how to Create a Class Using Java Example. in this example we show that Syntax of java object creation is <className> objectName = new <classConstructor>; and the Syntax of defining methods of the java class is <modifier> <return-type> method-Name(<optionalParameterList>) <ExceptionList>



 
by Dinesh Thakur

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

In this Example we Reading the numbers and string in the class Scanner becomes analogous to reading string. In this example, the two numbers are read from the console, results printed on the screen formatted output.

 
by Dinesh Thakur

Java program has two types. They are:

 

1. Application Program (Stand-alone application)

2. Applets Program.



 
by Dinesh Thakur

The first step of compiling and running a Java program is to write the text of your program in a document and save it on the hard drive. This document is called a source file, and you must name it with a .java extension. Next, compile this program using a Java compiler. The compiler checks the program for errors and, if no errors are found, it generates a new document containing Java bytecode. This document is called a class file, and its name ends with a .class extension.



 
by Dinesh Thakur

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

Public keyword is an access specifier.

Static allows main() to be called without having to instantiate a particular instance of class.

 
by Dinesh Thakur

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:



 
by Dinesh Thakur

'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

It is quite a tedious job to keep track of all the objects that have been created during the program development. It is tougher to keep track of the objects that are not being used now or their reference have been removed or the objects that have gone out of scope.

 
by Dinesh Thakur

A java class containing all the methods as abstract is called an interface. A method that has no implementation and which is expected to be implemented by a subclass is called an abstract method.



 
by Dinesh Thakur

In the real world, you'll often find many individual objects all of the same kind.All the objects that have similar properties and similar behavior are grouped together to form a class.

 
by Dinesh Thakur

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

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

The encapsulation is achieved by combining the methods and attribute into a class.The class acts like a container encapsulating the properties. The users are exposed mainly public methods.The idea behind is to hide how thinigs work and just exposing the requests a user can do.

 
by Dinesh Thakur

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

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

The Java Compiler (Javac) is a command line tool that reads java source code files and compiles them into executable Java bytecode classes. The Java source code must be contained in files whose file names end with .java extension.



 
by Dinesh Thakur

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