Monday, March 29, 2010

Declaring variables in java

to declare a variable in java we use the data type.
example:
int a;
int a=5;
float rph=1.2;
char s;
char let='A';
String s[]={"Hello", "World"};

Types, Values, and Variables

the java data types are:
--> integer
-->float
-->character
--> String
--> double

the values accept by the following data types are.
integer - 1,2,3,4,5,6,789,78
float - 1.2,1.0,3.8..... etc
character - 'A','a' ,'t' ,'h' ....
String - "Hello", "jaypee"
double - 1.22,1.04,1.90 .....

Hello world using java

this is a simple program in java.

import java.io.*;

public class helloworld
{
public static void main(String args[])
{
system.out.print("Hello World");
}
}