Java Data Types

Java Data Types
 

What is Data Type?
 

Data type is a classification of the type of information that a variable or object tin concur inwards reckoner programming.

Ex: character, integer, float etc....

> Java supports explicit annunciation of Data types.
(we involve to specify the information type earlier declaring the Variable)

Syntax:data_type variable_name;

data_type variable_name = value;

Example:
int a;

int a = 100;
----------------------
Two types of Data types inwards java:


a) Primitive Data types

b) Non-primitive Data types / Reference Data types
-----------------------------------
a) Primitive Data types (8 primitive information types)

Integer types1) byte (8 bits)

Ex:

byte a =100;

2) short (16 bits)

short a = 10000;

3) int (32 bits)

int a = 100000;

4) long (64 bits)

long a = 100000L
------------------
Rational types (Numbers amongst decimal places)5) float (32 bits)

float a = 1.2;

6) double (64 bits)
ex:
double a = 19.3456;
---------------------
Characters7) char (16 bits)

Ex:

char a ='Z'
------------------------
Conditional8) boolean (undefined, depends on JVM)

Ex:
boolean a = true
---------------------------------
b) Non-primitive / Reference information types
 

Non-primitive information types inwards Java are Objects too Arrays.

Note:

Reference types are non passed value, passed past times reference

Ex:

Button a = novel Button("OK")
-----------------------------------------------

Java String:

> Java String provides a lot of concepts that tin travel performed on Strings.

> Java String is non a information type inwards Java, It is a Class.

Declaring String variables too Arrays:

String myTool = "Selenium"; // String Variable

String [] myTools = {"Selenium", "UFT", "RFT", "SilkTest", LoadRunner"}; Array of Strings
----------------------------------------------- 
Also Read:

Java Variables

Java Operators 

Java Conditional Statements 

Java Loop Statements

Java Arrays 

Java Methods

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post