SlideShare a Scribd company logo
A data type is used to declare a variable. Every variable
should be declared before initialization.
Primitive data type Non Primitive data type
Boolean
Byte
Char
Short
Int
Long
Float
Double
String
Array
Class
 Byte-(Size is 2 byte)
*Its integer with small range
*Byte data type is an 8-bit signed two's complement integer.
*Minimum value is -128 (-2^7)
*Maximum value is 127 (inclusive)(2^7 -1)
* Default value is 0
* Byte data type is used to save space in large arrays, mainly in place of integers,
since a byte is four times smaller than an integer.
 Boolean-(T/F)(size is 1 byte)
Its true or false .by default its false
boolean data type represents one bit of information
There are only two possible values: true and false
Char –(size is 2 byte)
 char data type is a single 16-bit Unicode character
 Minimum value is 0
 Maximum value is 65,535
 Char data type is used to store any character from keyboard(0-
9,A-Z,a-z)
 Example: char letterA = 'A‘
 Short-(size is 2 bytes)
Its also integer type
 Short data type is a 16-bit signed two's complement integer
 Minimum value is -32,768 (-2^15)
 Maximum value is 32,767 (inclusive) (2^15 -1)
 Short data type can also be used to save memory as byte data type. A short is 2
times smaller than an integer
 Default value is 0.
 Example: short s = 10000, short r = -20000
 Int- (size is 4 bytes)
Its also integer data type with bigger size.
 Int data type is a 32-bit signed two's complement integer.
 Minimum value is - 2,147,483,648 (-2^31)
 Maximum value is 2,147,483,647(inclusive) (2^31 -1)
 Integer is generally used as the default data type for integral values unless there
is a concern about memory.
 The default value is 0
 Example: int a = 100000, int b = -200000
 Long- (size is 8 bytes)
Its also integer data type with more size
 Long data type is a 64-bit signed two's complement integer
 Minimum value is -9,223,372,036,854,775,808(-2^63)
 Maximum value is 9,223,372,036,854,775,807 (inclusive)(2^63 -1)
 This type is used when a wider range than int is needed
 Default value is 0L
 Example: long a = 100000L, long b = -200000L
 Float-(size is 4 bytes)
Used for decimal values
Float is mainly used to save memory in large arrays of floating point numbers
Default value is 0.0f
Float data type is never used for precise values such as currency
Example: float f1 = 234.5f
 Double- (size is 8 bytes)
- double data type is a double-precision 64-bit
- This data type is generally used as the default data type for decimal values,
generally the default choice.
- Double data type should never be used for precise values such as currency.
- Default value is 0.0d
- Example: double d1 = 123.4
 In computer science, the precision is usually measured in bits, but sometimes in
decimal digits. i.e no of digits after decimal point
 Float and double are two of the data types used to represent decimal values or
floating point literals in the Java programming language.
 Float is basically single precision and it can represent decimal values up to 7
digits of precision
 double can represent decimal values up to 16 digits of precision.
 Single Precision is a 32-bit type; Double Precision is a 64-bit type. Accordingly,
Doubles store a much broader range of values, and with much more precision.
 For example
If 10/3 is
3.3333333 ..its single precision
But if its 3.33333333333333..its double precision
By default java takes double precision.
String
 In Java, string is basically an object that represents sequence of char values. An
array of characters works same as Java string. For example: char[]
ch={'j','a','v','a','t','p','o','i','n','t'};
 a string is used to represent text rather than numbers. ... For example, the word
“java" and the phrase “I study java" are both strings. “34567" can be defined as
string if defined properly.
 The length of a string is determined by a termination null character.”0”. So a
string (“java”) has five characters. ‘j’,’a’,’v’,’a’. And null character ‘0’.
 An array is a container object that holds fixed number of values of a single type.
 Length of an array is decided when array is created.after creation its length is
fixed.
 A class can be defined as a template/blueprint that describes the behavior/state
that the object of its type support.
Public class dog
{
String breed;
Int age;
String color;

More Related Content

What's hot

NLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit DistanceNLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit Distance
Hemantha Kulathilake
 
Array
ArrayArray
Sienna 12 huffman
Sienna 12 huffmanSienna 12 huffman
Sienna 12 huffman
chidabdu
 
An Introduction : Python
An Introduction : PythonAn Introduction : Python
An Introduction : Python
Raghu Kumar
 
Spell checker using Natural language processing
Spell checker using Natural language processing Spell checker using Natural language processing
Spell checker using Natural language processing
Sandeep Wakchaure
 
TRIES_data_structure
TRIES_data_structureTRIES_data_structure
TRIES_data_structure
ddewithaman10
 
Do not delete!
Do not delete!Do not delete!
Do not delete!
Dimitar Dishev
 
Huffman
HuffmanHuffman
Huffman
keerthi vasan
 
Mca1010 fundamentals of computer and it
Mca1010  fundamentals of computer and itMca1010  fundamentals of computer and it
Mca1010 fundamentals of computer and it
smumbahelp
 
java programming basics - part ii
 java programming basics - part ii java programming basics - part ii
java programming basics - part ii
jyoti_lakhani
 
[ppt]
[ppt][ppt]
[ppt]
butest
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
tanmaymodi4
 
Python - variable types
Python - variable typesPython - variable types
Python - variable types
Learnbay Datascience
 
Ir models
Ir modelsIr models
Ir models
Ambreen Angel
 
Term weighting
Term weightingTerm weighting
Term weighting
Primya Tamil
 
Strings in Python
Strings in PythonStrings in Python
Strings in Python
Amisha Narsingani
 
Python strings
Python stringsPython strings
Python strings
Mohammed Sikander
 
Java -lec-6
Java -lec-6Java -lec-6
Java -lec-6
Zubair Khalid
 
Data types in python
Data types in pythonData types in python
Data types in python
Learnbay Datascience
 
C# chap 10
C# chap 10C# chap 10

What's hot (20)

NLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit DistanceNLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit Distance
 
Array
ArrayArray
Array
 
Sienna 12 huffman
Sienna 12 huffmanSienna 12 huffman
Sienna 12 huffman
 
An Introduction : Python
An Introduction : PythonAn Introduction : Python
An Introduction : Python
 
Spell checker using Natural language processing
Spell checker using Natural language processing Spell checker using Natural language processing
Spell checker using Natural language processing
 
TRIES_data_structure
TRIES_data_structureTRIES_data_structure
TRIES_data_structure
 
Do not delete!
Do not delete!Do not delete!
Do not delete!
 
Huffman
HuffmanHuffman
Huffman
 
Mca1010 fundamentals of computer and it
Mca1010  fundamentals of computer and itMca1010  fundamentals of computer and it
Mca1010 fundamentals of computer and it
 
java programming basics - part ii
 java programming basics - part ii java programming basics - part ii
java programming basics - part ii
 
[ppt]
[ppt][ppt]
[ppt]
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
Python - variable types
Python - variable typesPython - variable types
Python - variable types
 
Ir models
Ir modelsIr models
Ir models
 
Term weighting
Term weightingTerm weighting
Term weighting
 
Strings in Python
Strings in PythonStrings in Python
Strings in Python
 
Python strings
Python stringsPython strings
Python strings
 
Java -lec-6
Java -lec-6Java -lec-6
Java -lec-6
 
Data types in python
Data types in pythonData types in python
Data types in python
 
C# chap 10
C# chap 10C# chap 10
C# chap 10
 

Similar to Data types

Java - Basic Datatypes.pptx
Java - Basic Datatypes.pptxJava - Basic Datatypes.pptx
Java - Basic Datatypes.pptx
Nagaraju Pamarthi
 
Data types
Data typesData types
Data types
Dr. Rupinder Singh
 
Python slide.1
Python slide.1Python slide.1
Python slide.1
Aswin Krishnamoorthy
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
Mohammed Khan
 
5. variables & data types
5. variables & data types5. variables & data types
5. variables & data types
M H Buddhika Ariyaratne
 
Datatypes in c
Datatypes in cDatatypes in c
Data types in C
Data types in CData types in C
Data types in C
Ansh Kashyap
 
VHDL- data types
VHDL- data typesVHDL- data types
VHDL- data types
VandanaPagar1
 
Datatypes
DatatypesDatatypes
Datatypes
ZTE Nepal
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
Sujith Kumar
 
UNIT-1(Lesson 5).pptx
UNIT-1(Lesson 5).pptxUNIT-1(Lesson 5).pptx
UNIT-1(Lesson 5).pptx
NiteshKumar862859
 
Chapter 4 (Part II) - Array and Strings.pdf
Chapter 4 (Part II) - Array and Strings.pdfChapter 4 (Part II) - Array and Strings.pdf
Chapter 4 (Part II) - Array and Strings.pdf
KirubelWondwoson1
 
Programming Fundamentals lecture 6
Programming Fundamentals lecture 6Programming Fundamentals lecture 6
Programming Fundamentals lecture 6
REHAN IJAZ
 
Lect5
Lect5Lect5
C++ data types
C++ data typesC++ data types
C++ data types
pratikborsadiya
 
Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiers
Tanishq Soni
 
JAVA PROGRAMMING : Data types
JAVA PROGRAMMING : Data typesJAVA PROGRAMMING : Data types
JAVA PROGRAMMING : Data types
Kongu Engineering College, Perundurai, Erode
 
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++
Abdul Hafeez
 
Data types
Data typesData types
Data types
Nokesh Prabhakar
 
JAVA LESSON-01.pptx
JAVA LESSON-01.pptxJAVA LESSON-01.pptx
JAVA LESSON-01.pptx
StephenOczon1
 

Similar to Data types (20)

Java - Basic Datatypes.pptx
Java - Basic Datatypes.pptxJava - Basic Datatypes.pptx
Java - Basic Datatypes.pptx
 
Data types
Data typesData types
Data types
 
Python slide.1
Python slide.1Python slide.1
Python slide.1
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
5. variables & data types
5. variables & data types5. variables & data types
5. variables & data types
 
Datatypes in c
Datatypes in cDatatypes in c
Datatypes in c
 
Data types in C
Data types in CData types in C
Data types in C
 
VHDL- data types
VHDL- data typesVHDL- data types
VHDL- data types
 
Datatypes
DatatypesDatatypes
Datatypes
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
 
UNIT-1(Lesson 5).pptx
UNIT-1(Lesson 5).pptxUNIT-1(Lesson 5).pptx
UNIT-1(Lesson 5).pptx
 
Chapter 4 (Part II) - Array and Strings.pdf
Chapter 4 (Part II) - Array and Strings.pdfChapter 4 (Part II) - Array and Strings.pdf
Chapter 4 (Part II) - Array and Strings.pdf
 
Programming Fundamentals lecture 6
Programming Fundamentals lecture 6Programming Fundamentals lecture 6
Programming Fundamentals lecture 6
 
Lect5
Lect5Lect5
Lect5
 
C++ data types
C++ data typesC++ data types
C++ data types
 
Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiers
 
JAVA PROGRAMMING : Data types
JAVA PROGRAMMING : Data typesJAVA PROGRAMMING : Data types
JAVA PROGRAMMING : 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++
 
Data types
Data typesData types
Data types
 
JAVA LESSON-01.pptx
JAVA LESSON-01.pptxJAVA LESSON-01.pptx
JAVA LESSON-01.pptx
 

Recently uploaded

Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 

Recently uploaded (20)

Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 

Data types

  • 1.
  • 2. A data type is used to declare a variable. Every variable should be declared before initialization.
  • 3. Primitive data type Non Primitive data type Boolean Byte Char Short Int Long Float Double String Array Class
  • 4.  Byte-(Size is 2 byte) *Its integer with small range *Byte data type is an 8-bit signed two's complement integer. *Minimum value is -128 (-2^7) *Maximum value is 127 (inclusive)(2^7 -1) * Default value is 0 * Byte data type is used to save space in large arrays, mainly in place of integers, since a byte is four times smaller than an integer.
  • 5.  Boolean-(T/F)(size is 1 byte) Its true or false .by default its false boolean data type represents one bit of information There are only two possible values: true and false
  • 6. Char –(size is 2 byte)  char data type is a single 16-bit Unicode character  Minimum value is 0  Maximum value is 65,535  Char data type is used to store any character from keyboard(0- 9,A-Z,a-z)  Example: char letterA = 'A‘
  • 7.  Short-(size is 2 bytes) Its also integer type  Short data type is a 16-bit signed two's complement integer  Minimum value is -32,768 (-2^15)  Maximum value is 32,767 (inclusive) (2^15 -1)  Short data type can also be used to save memory as byte data type. A short is 2 times smaller than an integer  Default value is 0.  Example: short s = 10000, short r = -20000
  • 8.  Int- (size is 4 bytes) Its also integer data type with bigger size.  Int data type is a 32-bit signed two's complement integer.  Minimum value is - 2,147,483,648 (-2^31)  Maximum value is 2,147,483,647(inclusive) (2^31 -1)  Integer is generally used as the default data type for integral values unless there is a concern about memory.  The default value is 0  Example: int a = 100000, int b = -200000
  • 9.  Long- (size is 8 bytes) Its also integer data type with more size  Long data type is a 64-bit signed two's complement integer  Minimum value is -9,223,372,036,854,775,808(-2^63)  Maximum value is 9,223,372,036,854,775,807 (inclusive)(2^63 -1)  This type is used when a wider range than int is needed  Default value is 0L  Example: long a = 100000L, long b = -200000L
  • 10.  Float-(size is 4 bytes) Used for decimal values Float is mainly used to save memory in large arrays of floating point numbers Default value is 0.0f Float data type is never used for precise values such as currency Example: float f1 = 234.5f
  • 11.  Double- (size is 8 bytes) - double data type is a double-precision 64-bit - This data type is generally used as the default data type for decimal values, generally the default choice. - Double data type should never be used for precise values such as currency. - Default value is 0.0d - Example: double d1 = 123.4
  • 12.  In computer science, the precision is usually measured in bits, but sometimes in decimal digits. i.e no of digits after decimal point  Float and double are two of the data types used to represent decimal values or floating point literals in the Java programming language.  Float is basically single precision and it can represent decimal values up to 7 digits of precision  double can represent decimal values up to 16 digits of precision.  Single Precision is a 32-bit type; Double Precision is a 64-bit type. Accordingly, Doubles store a much broader range of values, and with much more precision.
  • 13.  For example If 10/3 is 3.3333333 ..its single precision But if its 3.33333333333333..its double precision By default java takes double precision.
  • 14. String  In Java, string is basically an object that represents sequence of char values. An array of characters works same as Java string. For example: char[] ch={'j','a','v','a','t','p','o','i','n','t'};  a string is used to represent text rather than numbers. ... For example, the word “java" and the phrase “I study java" are both strings. “34567" can be defined as string if defined properly.  The length of a string is determined by a termination null character.”0”. So a string (“java”) has five characters. ‘j’,’a’,’v’,’a’. And null character ‘0’.
  • 15.  An array is a container object that holds fixed number of values of a single type.  Length of an array is decided when array is created.after creation its length is fixed.
  • 16.  A class can be defined as a template/blueprint that describes the behavior/state that the object of its type support. Public class dog { String breed; Int age; String color;