Thursday, March 17, 2011

Food For Cirrhosis And Diabetic Patients



The Java variables representing memory spaces are reserved for storing the value of a type data.
The value of a variable may be modified during the execution of a program.
The name that identifies a variable called ID .


variable declaration in Java

A variable is declared as follows:
type identifier;

can also
declare multiple variables of the same type of data at once, as follows: type

identificador1, identificador2, identificadorN;




INITIATION OF VARIABLES IN JAVA

All variables we have declared our program, we must initiate , ie assign an initial value, which can modify it later, according to our needs, to avoid possible error messages.

to declare variables as attributes of the class, are initiated by the Java compiler, the other not.

A variable is initiated as follows:

identifier = value;
(you must declare the variable represented by ID)

also can be started multiple variables of the same type of data at once (the variables are declared and undertaken at the same time), as follows:

identificador1 type = value1, value2 = identificador2 .. , N identificadorN = value;


then shows how to declare and initiate variables at once, the various Java data types (variables can be declared not start, but not recommended)

type variables byte byte
 
b = 0;


Variables of type short
 
short a =- 100, b = 200;


Variables int
 
int a =- 3000;
int b = 558;


Variables of type long
 
long a = 2505L, / * indicates that the constant 2505 is long * /
long b = 13;
long c = 0xd / * hexadecimal value equivalent to 13 in decimal * /


Variables of type float
 
float a = 2.5478;
float b = 254.78e-2;
/ / value of b is equal to the value of a

float c = 4/5f;
/ / with f indicate 5 which is a float, it is necessary to indicate
/ / that at least one of the two values \u200b\u200bof the division is
/ / a float, otherwise, the result will not be the expected * /

float d = 4f / 5;
/ * gives the same result as above * /


Variables of type double double
 
a = 4.5478;
double b = 4.5478D;
double c = 3D / 4;
double d = 3/4D;


boolean variables
 
boolean a = true;
boolean b = false;


Variables char
 
/ / variables declared to below have the same value. AKEY
char = 'a';
AKEY char = 97, / * letter 'a' in decimal (ASCII) * / char
AKEY = 0x0061, / * letter 'a' in hexadecimal * /

0 comments:

Post a Comment