javanepal

Accepting Keyboard Input

First of all we need to know that in java for printing the line we use following command:

System.out.println();
While we code the System then it is related with input and output and all the hardware conf.
Then the keyword out defines about the display of the line.
Now we need to input instead of output.
So just code by following ways:
System.in.read();
Read More »Accepting Keyboard Input

Interface Class

Actually Interface are just like a class where it consists only constants and they
We can extend interface via interfaces
We can implement the interface via classes.
In interface needn’t use the “public” or “abstract” keywords – all methods
declared by an interface are automatically public and abstract by default.
A simple example of interface implement is given below.
[sourcecode=’java’]
public interface testInterface {
//one of the method without method body
void disp(String text);
}[/sourcecode]
For implementing this interface through normal class we follow below step:Read More »Interface Class

Polymorphism on three classes

This Polymorphism is one of the special feature of OOPL(Object oriented Programming Language). The polymorphism can perform several functions with a single method. A simple example of Polymorphism is given below according to real world.

polymorphism

fig. Polymorphism in real world

The term polymorphism refers to the ability of two or more objects belonging to different classes to respond to exactly the same message (method call) in different class-specific ways.Read More »Polymorphism on three classes