Java Essentials - Datatypes in java
3K views
Nov 28, 2024
Java Essentials - Datatypes in java
View Video Transcript
0:00
In this video we are discussing data types in Java
0:04
So data types in Java can mainly get divided into two categories
0:09
One is the primitive data type and the one is the non-primitive data type
0:13
So variables can have different types or data types. And they can store integer type of data, real values or say some character type of data, etc
0:24
And the types of data which can be stored in a variable is known as the data types
0:29
depending upon the data type how much memory space will get occupied against that
0:34
the variable that will be decided and what kind of value the variable can hold that
0:40
will be also decided data types can be divided into mainly two major parts one is
0:46
the primitive data types these data types are predefined Java compiler knows
0:51
them so it is a primitive data type because Java knows this type kind of
0:55
data types there so we can use any of them when we
0:59
we want to use them in our Java code. Non-primitive data types
1:05
So in case of non data types these data types are user User can define those data types and programmers can create non data types or abstract data types as when required in our code
1:19
And it is also known as abstract data type or ADT. So here we are having one representation that how this data types has got categorized
1:30
We are having this primitive data type, that means the Java compiler knows the type of the type of this
1:35
data it is pre-known to Java so in case of numeric we're having two categories
1:38
one is the integer another one is the floating point in case of floating point there are two categories that they're double and here we're having this
1:45
float so double is 64-bit and float is 32 bit that means four bytes for
1:51
float and then eight bytes for double under this integer we can have this byte
1:56
we can have short I and T long so these are falling under the
2:01
numeric data types if you come for the non-numeric data types you can have the
2:05
characters we can have the bullion data type so under this user defined data types that is the
2:11
ad t non data types so we having categories like our strings we having this arrays you can have the user defined classes so in this way we are having this non data types that is string is one of the non data types it is it is there is
2:27
defined with the help of the string class we're having this arrays we can have the user defined
2:33
classes also to be used as non-primitive data types so let us go forward here is the list of different
2:42
data types and their respective sizes so integer which will be known as INT in our Java code will be using INT all in the lowercase
2:50
letters so default value will be zero and it is having a size of 4 bytes in case of
2:55
byte it will be written as byte and default value is zero and it will be occupying one
3:01
byte of information in the memory that is the 8 bits we're having this long written as long
3:06
the default value is 0 and it will be occupying 8 bytes there we're having this short
3:12
in our Java code will be writing this short having the value zero and it is having
3:18
two bytes of allocation in the memory we're having this a float 0.0 is the
3:24
default value and there 4 bytes we having this double in our Java code will be writing this double all in the lower class letters 0 is the different value and 8 bytes is the size or the storage
3:36
getting occupied against one double type of variable we're having this character in our Java code
3:43
will be writing this one as care and it will be having this slash u 000 000 is the default
3:49
value here so it can be occupying it can be holding the asp code values or say it can have the
3:54
the representation is in a Unicode format and then we're having the size of that is
3:59
the two bytes here we're having this bullion in our Java code we'll be
4:03
writing this one as bullion all in the lowercase letters and default values false
4:08
and it will be occupying one byte in the computer's memory so in this way we
4:13
have defined that what are the different data types are available and all these data types whatever you have defined here we have discussed here in this
4:20
respective slide are all primitive data types so Java data types can be divided into two categories one is the primitive data types which is
4:28
pre-known to Java and the one is the non-primitive data types where you can have the
4:32
classes use the different classes we can have the errors there and that is known as
4:36
the non-primitive data type thanks for watching this video
#Computers & Electronics
#Data Formats & Protocols
#Java (Programming Language)
#Networking
#Programming