Download presentation
Presentation is loading. Please wait.
Published byAngel Hensley Modified over 9 years ago
1
Data type, Type Casting,Constants
2
DATA TYPES IN JAVA
3
Data types in java Every variable declared in a Java program is having the data type. Data type specifies the size and type of values that a variable can have. Java has a rich set of data types.
4
Integer Data Type
5
Real Data Type
6
Character & Boolean Data Type Character :In order to store single character constant in a variable, character data type is used. - minimum value is ‘\u000’=0 - maximum value is ‘\uffff’=65535 Boolean :Boolean data type is used to store two different values. But,values stored inside the boolean type will only be true and false.
7
Type Casting
8
What is type casting? Changing a value from one data type to another data type is known as data type conversion i.e. assigning a value of one type of a variable of another type is known as type casting. Types of type casting: 1.Widening Type Casting (Implicit) 2.Narrowing Type Casting ( Explicit)
9
Widening Type Casting (Implicit) If a value of lower size data type converted to a value of higher size data type without loss of information is Implicit casting.
10
Narrowing Type Casting ( Explicit) If a value of higher size data type converted to a value of lower size data type without loss of information is Implicit casting.
11
MSBTE Question Bank: Q1.Write all primitive data type available in java with their storage sizes in bytes.(w-9, s-12).Write all primitive data type available in java with their storage sizes in bytes Q2. List different data types in java.(s-10). List different data types in java Q3. Give all the primitive data types available in java with their strorage size in bytes. (s-13) Q4. Explain ‘type casting ‘ with example.(s-11)Explain ‘type casting ‘ with example Q5. What do you mean by type casting ?when is it needed?(w-12). What do you mean by type casting ?when is it needed?(
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.