java

Java’s Print similarities to C

As we know that java is made by the C programming. The java has many common features to C language. While we wants to print in java we usually use the following code.

But there is also the feature of printf in java which we used to do in C programming:

Syntax:

For eg:

which outputs like this in C :
c-out

But in JavaRead More »Java’s Print similarities to C

ToString() method

The toString() method is one of the feature of java. It is the method of class String which is imported default on JVM from java.lang.Object;

ToString() method is one of the display method.

When ever we tries to print the text from System.out.println("Hello"); then it directly inherit from the toString() method. We can override the toString() method and make the println to print what we desire.
Read More »ToString() method

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

Enum (eration) in Java

Here you can see the structure of Enum class in java. This class have their own rules and regulation.In this class there is no use of public except in the method value and class access because it doesn’t give any access to client. Some changable user-defined are written in italics.

For enum define , Just use below syntax

Read More »Enum (eration) in Java

Frame Height in Applet

Actually the the height we defined for JFrame may differ as what we assume . In windows JFrame uses its height including it’s title bar and the bottom border of window frame.It can be illustrated below :
Let’s we code the JFrame size.

In this code we can see that we defined a JFrame size to 100px width and 100px height. But actually some programmer feels problem on the height of the windows size , even we had declare the size of the JFrame to 100. The JFrame height includes the title bar and it’s bottom liner height.

Read More »Frame Height in Applet