SlideShare a Scribd company logo
1 of 14
Download to read offline
youtube: Zooming | https://github.com/Soba-Arjun/
Basic Datatypes
• Datatypes: int, String, float, short, byte, long,
double, Boolean.
• Datatypes used to create a variables.
• Variables are reserved memory location to store
values.
• When we create variables, we receive some
space in memory.
youtube: Zooming | https://github.com/Soba-Arjun/
96.6
200
P1713
Moon
name
regno
amountpercentage
Basic Datatypes
• Based on the datatype of variable, the operating
system allocate memory and decides what can
be stored in their memory.
• By assigning different values to variables, we
can store different datatypes.
• 2 datatypes: Primitive, Reference/Object
youtube: Zooming | https://github.com/Soba-Arjun/
96.6
200
P1713
Moon
name
regno
amountpercentage
Basic Datatypes – Primitive Data Types
• Primitive datatypes are predefined by the language and named by a keywords.
• There are 8 primitive datatypes supported by java.
youtube: Zooming | https://github.com/Soba-Arjun/
1. byte
2. short
3. int
4. long
5. float
6. double
7. boolean
8. char
Primitive Data Types ( byte)
• 8 bit signed 2’s complement integer.
youtube: Zooming | https://github.com/Soba-Arjun/
(-128)
(0)
• Used to save space in large array.
• 4 times smaller than int.
byte a = 68;
(127)
byte a = -128;
Primitive Data Types ( short)
• 16 bit signed 2’s complement integer.
youtube: Zooming | https://github.com/Soba-Arjun/
(-32,768)
(0)
(32,767)
• Used to save space in large array.
• 2 times smaller than int.
short a = 1000;short a = -1000;
Primitive Data Types ( int)
• 32 bit signed 2’s complement integer.
youtube: Zooming | https://github.com/Soba-Arjun/
(-2,147,483,648)
(0)
(2,147,483,647)
• Default datatypes for integral values.
• There is a concern about memory.
int a = 1236542;int a = -123648;
Primitive Data Types ( long)
• 64 bit signed 2’s complement integer.
youtube: Zooming | https://github.com/Soba-Arjun/
• This type is used when a wider range than int is need
int a = 10486L;long a = -100L;
L is maximum duration of 32
10486L =
-9,223,372,036,854,775,808 to 0L to -9,223,372,036,854,775,807
Primitive Data Types ( float)
• single-precision 32-bit IEEE 754 floating point.
youtube: Zooming | https://github.com/Soba-Arjun/
• Used to save memory in large arrays of floating point values.
• Never used for precise values such as currency.
float a = 234.5f;0.0f
Primitive Data Types ( double)
• double-precision 32-bit IEEE 754 floating point.
youtube: Zooming | https://github.com/Soba-Arjun/
• generally used as the default data type for decimal values.
• Never used for precise values such as currency.
double a = 234.5;0.0d
Primitive Data Types ( boolean)
• It represents one bit of information.
• 2 possible values: true and false.
• This data type is used for simple flags that
track true/false conditions.
• Default value: false.
youtube: Zooming | https://github.com/Soba-Arjun/
boolean a = true;
asign a=10
asign b=20
a=b //false
asign b=b-a
a=b //true
Primitive Data Types ( char)
• 16 bit Unicode character.
youtube: Zooming | https://github.com/Soba-Arjun/
• Char data type is used to store any character.
char a = ‘A’;‘u0000’
(0)
‘uffff’
(65,535 inclusive)
Basic Datatypes – Reference Data Types
• Reference variables are created using defined constructors of the classes.
• They are used to access objects.
• Class objects and various type of array variables come under reference datatype
• Default value is null.
youtube: Zooming | https://github.com/Soba-Arjun/
Animal a=new Animal();
Animal a=new Animal(0,’asdf’);
Basic Datatypes Notation Character represented
n Newline (0x0a)
r Carriage return (0x0d)
f Formfeed (0x0c)
b Backspace (0x08)
s Space (0x20)
t tab
" Double quote
' Single quote
 backslash
ddd Octal character (ddd)
uxxxx Hexadecimal UNICODE
character (xxxx)
youtube: Zooming | https://github.com/Soba-Arjun/
• Few special escape
sequences for String
and char literals

More Related Content

What's hot (20)

Primitive data types
Primitive data typesPrimitive data types
Primitive data types
 
Quick Scala
Quick ScalaQuick Scala
Quick Scala
 
Python Data Types
Python Data TypesPython Data Types
Python Data Types
 
Datatype
DatatypeDatatype
Datatype
 
ITFT - Java
ITFT - JavaITFT - Java
ITFT - Java
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
 
Python Data-Types
Python Data-TypesPython Data-Types
Python Data-Types
 
Numeric Data types in Python
Numeric Data types in PythonNumeric Data types in Python
Numeric Data types in Python
 
Classroom Object Oriented Language (COOL)
Classroom Object Oriented Language (COOL)Classroom Object Oriented Language (COOL)
Classroom Object Oriented Language (COOL)
 
Csc240 -lecture_4
Csc240  -lecture_4Csc240  -lecture_4
Csc240 -lecture_4
 
C# Basics
C# BasicsC# Basics
C# Basics
 
Data types in C
Data types in CData types in C
Data types in C
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 
What are variables and keywords in c++
What are variables and keywords in c++What are variables and keywords in c++
What are variables and keywords in c++
 
Java session3
Java session3Java session3
Java session3
 
Types in .net
Types in .netTypes in .net
Types in .net
 
Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data type
 
5variables in c#
5variables in c#5variables in c#
5variables in c#
 
C#
C#C#
C#
 

Similar to Java basic datatypes

Java basic datatypes
Java basic datatypesJava basic datatypes
Java basic datatypesSoba Arjun
 
Programming Language
Programming  LanguageProgramming  Language
Programming LanguageAdeel Hamid
 
SNIA : Swift Object Storage adding EC (Erasure Code)
SNIA : Swift Object Storage adding EC (Erasure Code)SNIA : Swift Object Storage adding EC (Erasure Code)
SNIA : Swift Object Storage adding EC (Erasure Code)Odinot Stanislas
 
Data Evolution on HBase with Kiji
Data Evolution on HBase with KijiData Evolution on HBase with Kiji
Data Evolution on HBase with KijiWibiData
 
Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)Adam Kunicki
 
2014 manchester-reproducibility
2014 manchester-reproducibility2014 manchester-reproducibility
2014 manchester-reproducibilityc.titus.brown
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...Yury Bushmelev
 
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...Derek Buitenhuis
 
(Julien le dem) parquet
(Julien le dem)   parquet(Julien le dem)   parquet
(Julien le dem) parquetNAVER D2
 
Java platform
Java platformJava platform
Java platformVisithan
 
Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Mohan Arumugam
 
Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Fwdays
 
CJUS 703Biblical Worldview of Corrections Assignment Instruction
CJUS 703Biblical Worldview of Corrections Assignment InstructionCJUS 703Biblical Worldview of Corrections Assignment Instruction
CJUS 703Biblical Worldview of Corrections Assignment InstructionVinaOconner450
 
SFDC Introduction to Apex
SFDC Introduction to ApexSFDC Introduction to Apex
SFDC Introduction to ApexSujit Kumar
 
How to Make OpenStack Heat Better based on Our One Year Production Journey
How to Make OpenStack Heat Better based on Our One Year Production JourneyHow to Make OpenStack Heat Better based on Our One Year Production Journey
How to Make OpenStack Heat Better based on Our One Year Production JourneyKaz Shinohara
 
Search at Twitter: Presented by Michael Busch, Twitter
Search at Twitter: Presented by Michael Busch, TwitterSearch at Twitter: Presented by Michael Busch, Twitter
Search at Twitter: Presented by Michael Busch, TwitterLucidworks
 

Similar to Java basic datatypes (20)

Java basic datatypes
Java basic datatypesJava basic datatypes
Java basic datatypes
 
Core java
Core javaCore java
Core java
 
Core java
Core javaCore java
Core java
 
Programming Language
Programming  LanguageProgramming  Language
Programming Language
 
SNIA : Swift Object Storage adding EC (Erasure Code)
SNIA : Swift Object Storage adding EC (Erasure Code)SNIA : Swift Object Storage adding EC (Erasure Code)
SNIA : Swift Object Storage adding EC (Erasure Code)
 
Data Evolution on HBase with Kiji
Data Evolution on HBase with KijiData Evolution on HBase with Kiji
Data Evolution on HBase with Kiji
 
Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)
 
2014 manchester-reproducibility
2014 manchester-reproducibility2014 manchester-reproducibility
2014 manchester-reproducibility
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
 
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...
 
(Julien le dem) parquet
(Julien le dem)   parquet(Julien le dem)   parquet
(Julien le dem) parquet
 
Java platform
Java platformJava platform
Java platform
 
Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)
 
Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"
 
CJUS 703Biblical Worldview of Corrections Assignment Instruction
CJUS 703Biblical Worldview of Corrections Assignment InstructionCJUS 703Biblical Worldview of Corrections Assignment Instruction
CJUS 703Biblical Worldview of Corrections Assignment Instruction
 
Automation using Puppet 3
Automation using Puppet 3 Automation using Puppet 3
Automation using Puppet 3
 
SFDC Introduction to Apex
SFDC Introduction to ApexSFDC Introduction to Apex
SFDC Introduction to Apex
 
How to Make OpenStack Heat Better based on Our One Year Production Journey
How to Make OpenStack Heat Better based on Our One Year Production JourneyHow to Make OpenStack Heat Better based on Our One Year Production Journey
How to Make OpenStack Heat Better based on Our One Year Production Journey
 
Search at Twitter: Presented by Michael Busch, Twitter
Search at Twitter: Presented by Michael Busch, TwitterSearch at Twitter: Presented by Michael Busch, Twitter
Search at Twitter: Presented by Michael Busch, Twitter
 
Python ml
Python mlPython ml
Python ml
 

More from Soba Arjun

Java interview questions
Java interview questionsJava interview questions
Java interview questionsSoba Arjun
 
Java modifiers
Java modifiersJava modifiers
Java modifiersSoba Arjun
 
Java variable types
Java variable typesJava variable types
Java variable typesSoba Arjun
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questionsSoba Arjun
 
C interview questions
C interview questionsC interview questions
C interview questionsSoba Arjun
 
Technical interview questions
Technical interview questionsTechnical interview questions
Technical interview questionsSoba Arjun
 
Php interview questions with answer
Php interview questions with answerPhp interview questions with answer
Php interview questions with answerSoba Arjun
 
Computer Memory Types - Primary Memory - Secondary Memory
Computer Memory Types - Primary Memory - Secondary MemoryComputer Memory Types - Primary Memory - Secondary Memory
Computer Memory Types - Primary Memory - Secondary MemorySoba Arjun
 
Birds sanctuaries
Birds sanctuariesBirds sanctuaries
Birds sanctuariesSoba Arjun
 
Important operating systems
Important operating systemsImportant operating systems
Important operating systemsSoba Arjun
 
Important branches of science
Important branches of scienceImportant branches of science
Important branches of scienceSoba Arjun
 
Important file extensions
Important file extensionsImportant file extensions
Important file extensionsSoba Arjun
 
Java Abstraction
Java AbstractionJava Abstraction
Java AbstractionSoba Arjun
 
Java Polymorphism
Java PolymorphismJava Polymorphism
Java PolymorphismSoba Arjun
 
Java Overriding
Java OverridingJava Overriding
Java OverridingSoba Arjun
 
Java Inner Classes
Java Inner ClassesJava Inner Classes
Java Inner ClassesSoba Arjun
 
java Exception
java Exceptionjava Exception
java ExceptionSoba Arjun
 
java Inheritance
java Inheritancejava Inheritance
java InheritanceSoba Arjun
 
Major tribes of india
Major tribes of indiaMajor tribes of india
Major tribes of indiaSoba Arjun
 

More from Soba Arjun (20)

Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Java modifiers
Java modifiersJava modifiers
Java modifiers
 
Java variable types
Java variable typesJava variable types
Java variable types
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questions
 
C interview questions
C interview questionsC interview questions
C interview questions
 
Technical interview questions
Technical interview questionsTechnical interview questions
Technical interview questions
 
Php interview questions with answer
Php interview questions with answerPhp interview questions with answer
Php interview questions with answer
 
Computer Memory Types - Primary Memory - Secondary Memory
Computer Memory Types - Primary Memory - Secondary MemoryComputer Memory Types - Primary Memory - Secondary Memory
Computer Memory Types - Primary Memory - Secondary Memory
 
Birds sanctuaries
Birds sanctuariesBirds sanctuaries
Birds sanctuaries
 
Important operating systems
Important operating systemsImportant operating systems
Important operating systems
 
Important branches of science
Important branches of scienceImportant branches of science
Important branches of science
 
Important file extensions
Important file extensionsImportant file extensions
Important file extensions
 
Java Abstraction
Java AbstractionJava Abstraction
Java Abstraction
 
Java Polymorphism
Java PolymorphismJava Polymorphism
Java Polymorphism
 
Java Overriding
Java OverridingJava Overriding
Java Overriding
 
Java Inner Classes
Java Inner ClassesJava Inner Classes
Java Inner Classes
 
java Exception
java Exceptionjava Exception
java Exception
 
Java Methods
Java MethodsJava Methods
Java Methods
 
java Inheritance
java Inheritancejava Inheritance
java Inheritance
 
Major tribes of india
Major tribes of indiaMajor tribes of india
Major tribes of india
 

Recently uploaded

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 

Recently uploaded (20)

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 

Java basic datatypes

  • 1. youtube: Zooming | https://github.com/Soba-Arjun/
  • 2. Basic Datatypes • Datatypes: int, String, float, short, byte, long, double, Boolean. • Datatypes used to create a variables. • Variables are reserved memory location to store values. • When we create variables, we receive some space in memory. youtube: Zooming | https://github.com/Soba-Arjun/ 96.6 200 P1713 Moon name regno amountpercentage
  • 3. Basic Datatypes • Based on the datatype of variable, the operating system allocate memory and decides what can be stored in their memory. • By assigning different values to variables, we can store different datatypes. • 2 datatypes: Primitive, Reference/Object youtube: Zooming | https://github.com/Soba-Arjun/ 96.6 200 P1713 Moon name regno amountpercentage
  • 4. Basic Datatypes – Primitive Data Types • Primitive datatypes are predefined by the language and named by a keywords. • There are 8 primitive datatypes supported by java. youtube: Zooming | https://github.com/Soba-Arjun/ 1. byte 2. short 3. int 4. long 5. float 6. double 7. boolean 8. char
  • 5. Primitive Data Types ( byte) • 8 bit signed 2’s complement integer. youtube: Zooming | https://github.com/Soba-Arjun/ (-128) (0) • Used to save space in large array. • 4 times smaller than int. byte a = 68; (127) byte a = -128;
  • 6. Primitive Data Types ( short) • 16 bit signed 2’s complement integer. youtube: Zooming | https://github.com/Soba-Arjun/ (-32,768) (0) (32,767) • Used to save space in large array. • 2 times smaller than int. short a = 1000;short a = -1000;
  • 7. Primitive Data Types ( int) • 32 bit signed 2’s complement integer. youtube: Zooming | https://github.com/Soba-Arjun/ (-2,147,483,648) (0) (2,147,483,647) • Default datatypes for integral values. • There is a concern about memory. int a = 1236542;int a = -123648;
  • 8. Primitive Data Types ( long) • 64 bit signed 2’s complement integer. youtube: Zooming | https://github.com/Soba-Arjun/ • This type is used when a wider range than int is need int a = 10486L;long a = -100L; L is maximum duration of 32 10486L = -9,223,372,036,854,775,808 to 0L to -9,223,372,036,854,775,807
  • 9. Primitive Data Types ( float) • single-precision 32-bit IEEE 754 floating point. youtube: Zooming | https://github.com/Soba-Arjun/ • Used to save memory in large arrays of floating point values. • Never used for precise values such as currency. float a = 234.5f;0.0f
  • 10. Primitive Data Types ( double) • double-precision 32-bit IEEE 754 floating point. youtube: Zooming | https://github.com/Soba-Arjun/ • generally used as the default data type for decimal values. • Never used for precise values such as currency. double a = 234.5;0.0d
  • 11. Primitive Data Types ( boolean) • It represents one bit of information. • 2 possible values: true and false. • This data type is used for simple flags that track true/false conditions. • Default value: false. youtube: Zooming | https://github.com/Soba-Arjun/ boolean a = true; asign a=10 asign b=20 a=b //false asign b=b-a a=b //true
  • 12. Primitive Data Types ( char) • 16 bit Unicode character. youtube: Zooming | https://github.com/Soba-Arjun/ • Char data type is used to store any character. char a = ‘A’;‘u0000’ (0) ‘uffff’ (65,535 inclusive)
  • 13. Basic Datatypes – Reference Data Types • Reference variables are created using defined constructors of the classes. • They are used to access objects. • Class objects and various type of array variables come under reference datatype • Default value is null. youtube: Zooming | https://github.com/Soba-Arjun/ Animal a=new Animal(); Animal a=new Animal(0,’asdf’);
  • 14. Basic Datatypes Notation Character represented n Newline (0x0a) r Carriage return (0x0d) f Formfeed (0x0c) b Backspace (0x08) s Space (0x20) t tab " Double quote ' Single quote backslash ddd Octal character (ddd) uxxxx Hexadecimal UNICODE character (xxxx) youtube: Zooming | https://github.com/Soba-Arjun/ • Few special escape sequences for String and char literals