Tuesday, January 29, 2019

Based on the type of data stored, data types are classifying as 3 types in Java.
  1. Primitive Datatype (Fundamental Datatype):
  2. Derived Datatype
  3. User Defined Datatype
Primitive Datatype (Fundamental Datatype)
The datatype which stores only single value is Primitive datatype. Primitive datatypes are also known as fundamental datatypes. In java programming language, there are 8 primitive datatypes classified into 4 categories.
  • Integer type category
  • Floating-point category
  • Character type category
  • Boolean type category
            Ex: int, float, char etc.,
Derived Datatypes: 
Derived datatypes are pre-defined datatypes given by the programming language. These derived datatypes are created by primitive datatypes and they can be used for storing multiple values.
            Ex: Array
User Defined Datatypes:
These datatypes will be created by the programmer according to application requirement, in which we can store any type of values and number of values.
            Ex: Class

1. Integer Category Data Types:
This category can be used for storing numbers which can be either +ve or -ve without decimal points.
We have 4 types under integer category. The size and range are as below:
 Data Type                               Size                                                 Range
  byte                                       1 Byte (2^8)                               -128 to 127
  short                                      2 Bytes                                       -32768 to 32767
  int                                          4 Bytes                              -2,147,483,648 to 2,147,483,647
  long                                       8 Bytes        -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

2. Floating-Point Category Data Types:
This category can be used for storing numbers which can be +ve or -ve with decimal points. We have two types under floating point category:
Data Type                               Size                                                 Range
  float                                       4 Bytes                                  1.4 e^-45 to 3.4 e^38
  double                                   8 Bytes                                  4.9e^-324 to 1.8 e^308

3. Character Type Category Data Type:
This category can be used for storing a single character. A character can be represented by an Alphabet or a digit or a special symbol.
This category contains only one datatype that is Char.
Data Type                               Size                                                 Range
  Char                                    2 Bytes                                             0 to 65535

4. Boolean Type Category Data Type:
This category can be used for storing either True or False. We have only one datatype under this category that is Boolean.
Data Type                               Size                                                 Range
  Boolean                          JVM Dependent                                 True or False

Related Posts:

  • BufferedReader vs Scanner Difference between BufferedReader and Scanner: It can parse the user input and read an int, short, byte, float, long and double apart from String. On the other hand, BufferedReader can only read String in Java. BuffredReade… Read More
  • How to iterate through a Map Elements we cannot iterate a Map directly using iterators, because Map are not Collection. There are different methods to iterate through MAP elements: Method 1: Using Iterator and keySet(). package seleniumrepo; import java.ut… Read More
  • Armstrong Program in Java Write a Java program to find whether given number is Armstrong or not Armstrong numbers are: 153, 370, 371, 407 Definition: We call a given number as Armstrong if it is equal to the sum of the powers of its own digits. Ex:&n… Read More
  • Extract numeric value from a String                    package seleniumrepo;                           public class ExtractNumerics{  … Read More
  • White Box Testing (WBT) vs Black Box Testing (BBT) Difference between White Box Testing and Black Box Testing: WBT: This is defined as method of testing in which one can perform testing on an application having internal structural knowledge of it. This is also kno… Read More

0 comments:

Post a Comment

Selenium Training in Realtime

Blog helps to a student or IT employee to develop or improve skills in Software Testing.

Followers

About Me

My photo
Hyderabad, Andhra Pradesh, India
I am Automation Testing Professional. I have completed my graduation in B.Tech (Computers) from JNTU Hyderabad and started my career in Software Testing accidentally since then, I passionate on learning new technologies

Contact Form

Name

Email *

Message *

Popular Posts