Tuesday, November 30, 2010

how can i create variable in java !!!

well creating variables in java is extremely easy like all other programming languages....................................................
integers can be created as

int data;
int data=5;
int data,result,sum;

long can be created as

long data;
long data=14.0;
long data,result,sum;

float can be 
float data; 
float data=4F;                  //this statment will execute as well and will convert 4 to float 4. this is called literals.
float data,result,sum;



double can be

double data;
double data=10D;        //this statment will execute as well and will convert 4 to double 4. this is called literals.
double data,result,sum;
characters can be created as
char data;
char data='k';
String could be created as
String data;
String data="hi ! this is java programme";

No comments:

Post a Comment