AddThis

Wednesday, 16 January 2019

Java data types / primitive and user defined data types

Java Data Types

  • Data type represents:
    • Type of data we want to use.
    • Amount of memory allocation required for data.
There are two types of data types:
  1. Primitive data types
  2. User defined data types
1. Primitive data types: 
  • There are 8 primitive data types available in Java.
  • 8 keywords are defined to represent 8 primitive data types.
  • Following are primitive data types: byte, short, int, long, float, double, char, boolean


2. User defined data types
  • There are four types of user defined data types:
    • Class type
    • Interface type
    • Enum type  (From Java 5)
    • Annotation type (From Java 5)


No comments:

Post a Comment

Core functional interfaces in Java (Function, Predicate, Consumer, and Supplier)

  The four core functional interfaces in Java ( Function , Predicate , Consumer , and Supplier ) are the backbone of lambda expressions a...