The data type is a basic concept that should be controlled by the programmer. The data type is used to determine the type of the value or values that are stored in memory, and that will be processed in the program. The data type in Java is divided into two parts, namely the primitive data types and data type references. Let's discuss one by one.
A. Primitive Data Types
Primitive data type is a standard data type that is not derived from any object. Primitive data type is a data type that is most commonly used in the program. That is why a programmer should know, understand, and understand about the type of data. In Java, there are eight primitive data types, namely: byte, short, int, long, float, double, boolean, and char.
1. Byte
Byte data type is a data type with the size and distance (range) is small, where the data type bye only has a size of 8 bits, and long-range only up to 127. -128 byte data type is usually used at the time of our work, which for the purposes of the the process of reading or writing.
example:
byte a = 127;
2. Int (Integer)
The integer data type is a data type that is most commonly used. Why? Because the data type is considered more efficient than other types of data. The size of the data type Int (Integer) is 32 bits with long range -2147483648 sd 2147483647.
example:
Int a = 2147483647;
3. Long
The data type is often used in special circumstances, which if used in excess of the value of long-range data type int (integer), then this data type is often used long. Why? because this data type has a length range longer than that -9,223,372,036,854,775,808 int sd 9223372036854775807, but the size of this data type lumanyan compared with int data type that is 64bit.
example:
long a = 9223372036854775807;
4. Short
This data type has a size of 16 bits with long-range range from -32 768 sd 32767. This data type is very rarely used, because usually the type dataini kompter applied to 16bit.
example:
short a = 32767;
5. Boolean
Sebuha boolean data type is a data type that is used for the logic value, ie the value which is used only in the form of True or False (True or False).
example:
boolean a = true;
boolean b = false;
6. Char
Char data type is a data type that is used to express a character. Unicode characters are characters used by the java language to represent all the characters. Unicode not know right? Unicode is a collection of characters that exist in all languages, including Arabic, and Latin.
example:
char a = '$ # @';
7. Double
This data type is a data type that is similar to a float data type. However, long-range and size of the larger double data type, which is the length rangenya +/- 1.8 x 10 308 with a size of 64 bits. Excellent double data type is used for the calculation, because this data type more quickly perform mathematical calculations in comparison with the data type float. And also this data type produces more accurate results than the float data type.
example:
double a = 1.79769313486231570;
8. Float
Float data type is a data type that is often used in the use of a fractional value. Rangenya length is +/- 3.4 x 1038 with a size of 32 bits. However, There is a weakness in this data type that will arise a problem if the use of this data type for numbers that are too small or too big. The problem that arises is the resulting value becomes inaccurate. Examples for temperature measurement.
example:
float a = 3.40282346638528860;
B. Reference Data Types
Reference data type is a data type that is used in or Object Oriented Programming OOP (object oriented programming). So in this OOP we can create or define a new data type that is the object of a particular class. All reference data type default value is zero or null, unlike the primitive data types that memiiliki default values varied.
Functions are used:
Modifier NamaTipe NamaVariable;
Some differences between Primitive Data Types and References:
Primitive Data Types
Primitive data types directly defined by java.
Primitive type represents a single value.
Relative Data Types
Define the data type in the User Reference.
Virgin type can reference the value of zero or more menapung primitive value or object.
Keyword :
java, contoh program, download, script,Tutorials,Programming, Learning, Sun Microsystems, Install, Developer, Updates, Software, Coding, Latest, Version, Data Types
Artikel keren lainnya:
fon perde modelleri
ReplyDeleteSms Onay
MOBİL ODEME BOZDURMA
Nftnasilalinir
Ankara evden eve nakliyat
Trafik Sigortası
dedektor
web sitesi kurma
aşk kitapları