Every programming language is designed to process some kind of data , the data can be:
Number,Character and strings.
So after processing this data the program will give some information as result.
The processing of data is a sequence of some instructions, so every program will be consist of sequence of instructions, keep in mind that the every programming language have a syntax of write the instructions, like to write English we have to follow the grammar syntax.
The instructions written in Java will have following things:
Constants:It is a fix value that do not change during the execution of java program.Java programming language have different types of constants:
Integer constants:It is a sequence of digits, there are three types of integers:
decimal , octal and hexadecimal
Eg: 123 -549 0
Real Constants: It a sequence of digits that contains fractional part as well.These are used to represent the fractional values like prices, heights etc.
Eg: 125.25 .95
These can be represented in exponential notation as well. Here is one example let say you want to write the number 221.65 into exponential notation then it will be written as 2.2165e2 , so e2 means multiply the number by 102.
The notation is known as:
mantissa e exponent
The exponent part can have + or - sign, please be informed the exponent part cause the decimal point to "float". So this notation is said to represent a real number into floating point form.
Here we will give couple of examples:
The number 4200000000 will be written as 4.2E9 or 42E8
The number -0.000000365 will be written as -3.65E-7
Single Character Constant:A single character constant contains only one character enclosed in single character quote pair. Here are some examples of it:
Eg: 'x' 'f' '5' '8'
please be informed now the character '8' is not a number 8 it is a character constant not a integer constant.
String Constants: It contains a sequence of characters which are also enclosed in double quotes(not a single quote).
Eg:
"Hello Java Program" "1995" "This is good" "7+8+7"
Variables: you can think like it is a memory container that will store a value during java program execution and this container will store a certain type of data value only, and we called it data type.
in Java there are three categories of variables:Local, Instance and Static.
Variable example:
Number,Character and strings.
So after processing this data the program will give some information as result.
The processing of data is a sequence of some instructions, so every program will be consist of sequence of instructions, keep in mind that the every programming language have a syntax of write the instructions, like to write English we have to follow the grammar syntax.
The instructions written in Java will have following things:
- Constants
- Variables
- Control statements
Constants:It is a fix value that do not change during the execution of java program.Java programming language have different types of constants:
Integer constants:It is a sequence of digits, there are three types of integers:
decimal , octal and hexadecimal
Eg: 123 -549 0
Real Constants: It a sequence of digits that contains fractional part as well.These are used to represent the fractional values like prices, heights etc.
Eg: 125.25 .95
These can be represented in exponential notation as well. Here is one example let say you want to write the number 221.65 into exponential notation then it will be written as 2.2165e2 , so e2 means multiply the number by 102.
The notation is known as:
mantissa e exponent
The exponent part can have + or - sign, please be informed the exponent part cause the decimal point to "float". So this notation is said to represent a real number into floating point form.
Here we will give couple of examples:
The number 4200000000 will be written as 4.2E9 or 42E8
The number -0.000000365 will be written as -3.65E-7
Single Character Constant:A single character constant contains only one character enclosed in single character quote pair. Here are some examples of it:
Eg: 'x' 'f' '5' '8'
please be informed now the character '8' is not a number 8 it is a character constant not a integer constant.
String Constants: It contains a sequence of characters which are also enclosed in double quotes(not a single quote).
Eg:
"Hello Java Program" "1995" "This is good" "7+8+7"
Variables: you can think like it is a memory container that will store a value during java program execution and this container will store a certain type of data value only, and we called it data type.
in Java there are three categories of variables:Local, Instance and Static.
Variable example: