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:

  • ArrayList vs LinkedList Difference between ArrayList and LinkedList? Similarities: Both implements List interface(linkedlist also implements deque interface), maintains insertion order and can contain duplicate elements. Both are non synchroni… Read More
  • Encapsulation in Java Encapsulation is to make sure that "sensitive" data is hidden from users. To achieve this, you must: declare class variables/attributes as private (only accessible within the same class) provide public setter and getter m… Read More
  • Retrieve Test Data from an Excel file with Apache POI A Java Program to retrieve the data from an excel file?   Below is the code to read .xlsx file.                                XSSFWorkbo… Read More
  • What is Manual Testing and its Advantages, Limitations Manual testing is a testing process that is carried out manually(executing test cases) in order to find defects without the usage of tools or automation scripting. It is the most primitive of all testing types and… Read More
  • Introduction to Test Automation What is Test Automation: Test Automation or Automation Testing is a method of automating execution of tests and then  compares actual test results with predicted or expected results using special softwar… 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