sometimes we need to execute a block of code in several recurrent times. this action called a loop and for this action Java have some Loop statments as the following: while Loop: A while loop is a control structure that allows you to repeat a task a certain number of times. and it means while […]
Programming is conditions and it is the main core of start writing a code as when you think in any problem you will find that you need to take decision for that we have decision making statments as the following: The if-then Statement: An if statement consists of an expression followed by one or more statements. this expression evaluates […]
Operators are special symbols that perform specific operations on one, two, or three operands, and then return a result. As we explore Java operators, it will be helpful for any body to know ahead of time which operators have the highest precedence. The operators in the following table are listed according to precedence order. The closer […]
Variables must be declared before being used. basically the type is one of Java’s datatypes. The identifier is the name of the variable. To declare more than one variable of the specified type, use a comma-separated list.
datatype identifier [ = value][, identifier [= value] ...] ;
Here are several examples of variable declarations of various types. Note that some include an initialization.
int a, b, c; // declares three ints, a, b, and c.
int d = 3, e, f = 5; // declares three more ints, initialising d and f.
byte z = 22; // initializes z.
double pi = 3.14159; // declares an approximation of pi.
char x = 'x'; // the variable x has the value ‘x'.
Usualy when you create a variable you reserve some space in memory Based on its data type, the operating system allocates memory and decides what can be stored in the reserved memory. There are two data types available in Java: Primitive Reference/Object Primitive Data Types: There are eight primitive data types supported by Java. Primitive data types […]
A normal deffinaton of Java program is a collection of objects that communicate by using each other’s methods. And: Object: In language a material thing that can be seen and touched. a person or thing to which a specified action or feeling is directed. in Programming : A lines of codes that have have states/properties and behaviors/methods. also […]
Java growth and got a widespread popularity, multiple configurations were built to suite various types of platforms. Ex: J2EE for Enterprise Applications, J2ME for Mobile Applications. So Java is: Object Oriented: In Java, everything is an Object. Java can be easily extended since it is based on the Object model. Platform independent: Unlike many other programming languages including C […]