SlideShare a Scribd company logo
Every variable must have a data type. A variable's data type determines the values that
the variable can contain and the operations that can be performed on it. The Java
programming language has two categories of data types: primitive and reference.
Primitives are data types whose state represents a number, a character, or a true/false
indication.

Primitive types are not class types; they do not provide any behavior associated with the
type appropriate values they hold. Java has eight primitive types that should look
familiar to you from other languages: The table below lists some examples of primitive
data types.



     int                 Integer              32-bit two’s            178
                                             complement
    float       Single-precision floating   32-bit IEEE 754
                          point
    char           A single character        16-bit Unicode           ‘c ’
                                                character
  boolean       A boolean value (true or      true or false           true
                        false)
                                                                     false




Reference types in Java are Classes, Interfaces, and Arrays. When you declare a
reference type variable you are specifying that the variable will refer, or point to an
object, instead of holding a single value as a primitive type.



Here's an example of declaring an integer variable:



int maxLoginAttempts = 3;
When you create a variable in Java, you must know a few things:



   •   You must know what data type you are going to use.
   •   You must know what you want to call the variable.

   •   You might also want to know the value with which the variable should be
       initialized.

More Related Content

What's hot

C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
Dr.Neeraj Kumar Pandey
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
Madishetty Prathibha
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
NIDA HUSSAIN
 
12pointerin c#
12pointerin c#12pointerin c#
12pointerin c#
Sireesh K
 
Doppl development iteration #2
Doppl development   iteration #2Doppl development   iteration #2
Doppl development iteration #2
Diego Perini
 
Core Java Programming Language (JSE) : Chapter III - Identifiers, Keywords, ...
Core Java Programming Language (JSE) : Chapter III -  Identifiers, Keywords, ...Core Java Programming Language (JSE) : Chapter III -  Identifiers, Keywords, ...
Core Java Programming Language (JSE) : Chapter III - Identifiers, Keywords, ...
WebStackAcademy
 
Java generics(Under The Hood Of The Compiler) by Harmeet singh
Java generics(Under The Hood Of The Compiler) by Harmeet singhJava generics(Under The Hood Of The Compiler) by Harmeet singh
Java generics(Under The Hood Of The Compiler) by Harmeet singh
Harmeet Singh(Taara)
 
Type system
Type systemType system
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
 
Python revision tour -I
Python revision tour -IPython revision tour -I
Python revision tour -I
Navodaya Vidyalaya Samiti
 
Elements of functional programming
Elements of functional programmingElements of functional programming
Elements of functional programming
Sajjad Ali Pulikkanat
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
Vasuki Ramasamy
 
Java tokens
Java tokensJava tokens
Java tokens
shalinikarunakaran1
 
fundamentals of c
fundamentals of cfundamentals of c
fundamentals of c
Vijayalaxmi Wakode
 
Concepts of core java
Concepts of core javaConcepts of core java
Concepts of core java
AkshitaMangrulkar
 
JetBrains MPS: Editor Aspect
JetBrains MPS: Editor AspectJetBrains MPS: Editor Aspect
JetBrains MPS: Editor Aspect
Mikhail Barash
 
C#
C#C#

What's hot (20)

C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
12pointerin c#
12pointerin c#12pointerin c#
12pointerin c#
 
Doppl development iteration #2
Doppl development   iteration #2Doppl development   iteration #2
Doppl development iteration #2
 
Core Java Programming Language (JSE) : Chapter III - Identifiers, Keywords, ...
Core Java Programming Language (JSE) : Chapter III -  Identifiers, Keywords, ...Core Java Programming Language (JSE) : Chapter III -  Identifiers, Keywords, ...
Core Java Programming Language (JSE) : Chapter III - Identifiers, Keywords, ...
 
Java generics(Under The Hood Of The Compiler) by Harmeet singh
Java generics(Under The Hood Of The Compiler) by Harmeet singhJava generics(Under The Hood Of The Compiler) by Harmeet singh
Java generics(Under The Hood Of The Compiler) by Harmeet singh
 
Type system
Type systemType system
Type system
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Csharp4 basics
Csharp4 basicsCsharp4 basics
Csharp4 basics
 
Python revision tour -I
Python revision tour -IPython revision tour -I
Python revision tour -I
 
Elements of functional programming
Elements of functional programmingElements of functional programming
Elements of functional programming
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
 
Java tokens
Java tokensJava tokens
Java tokens
 
fundamentals of c
fundamentals of cfundamentals of c
fundamentals of c
 
Concepts of core java
Concepts of core javaConcepts of core java
Concepts of core java
 
JetBrains MPS: Editor Aspect
JetBrains MPS: Editor AspectJetBrains MPS: Editor Aspect
JetBrains MPS: Editor Aspect
 
7.pointers
7.pointers7.pointers
7.pointers
 
C#
C#C#
C#
 
Data type
Data typeData type
Data type
 

Viewers also liked

รายรับรายจ่าย สิงหาคม
รายรับรายจ่าย สิงหาคมรายรับรายจ่าย สิงหาคม
รายรับรายจ่าย สิงหาคมSiwakon Moonla
 
Borang analisa pencapaian pelajar
Borang analisa pencapaian pelajarBorang analisa pencapaian pelajar
Borang analisa pencapaian pelajarSiti Rahman
 
Slideshare (1)
Slideshare (1)Slideshare (1)
Slideshare (1)james122
 
Onnek van blogja_weboldala
Onnek van blogja_weboldalaOnnek van blogja_weboldala
Onnek van blogja_weboldala
György Svegál
 
Minutes mpc 2.10.2012
Minutes mpc 2.10.2012Minutes mpc 2.10.2012
Minutes mpc 2.10.2012clerkmoulton
 
Case Solution for Telefonica de Argentina S.A.
Case Solution for Telefonica de Argentina S.A.Case Solution for Telefonica de Argentina S.A.
Case Solution for Telefonica de Argentina S.A.
casesolutions
 
Mapa mental ciclos de trabajo mcia
Mapa mental ciclos de trabajo mciaMapa mental ciclos de trabajo mcia
Mapa mental ciclos de trabajo mciaHenry Viancha
 

Viewers also liked (10)

Reseña 1
Reseña 1Reseña 1
Reseña 1
 
รายรับรายจ่าย สิงหาคม
รายรับรายจ่าย สิงหาคมรายรับรายจ่าย สิงหาคม
รายรับรายจ่าย สิงหาคม
 
Borang analisa pencapaian pelajar
Borang analisa pencapaian pelajarBorang analisa pencapaian pelajar
Borang analisa pencapaian pelajar
 
Conceptos drogas
Conceptos drogasConceptos drogas
Conceptos drogas
 
Slideshare (1)
Slideshare (1)Slideshare (1)
Slideshare (1)
 
Certificado
CertificadoCertificado
Certificado
 
Onnek van blogja_weboldala
Onnek van blogja_weboldalaOnnek van blogja_weboldala
Onnek van blogja_weboldala
 
Minutes mpc 2.10.2012
Minutes mpc 2.10.2012Minutes mpc 2.10.2012
Minutes mpc 2.10.2012
 
Case Solution for Telefonica de Argentina S.A.
Case Solution for Telefonica de Argentina S.A.Case Solution for Telefonica de Argentina S.A.
Case Solution for Telefonica de Argentina S.A.
 
Mapa mental ciclos de trabajo mcia
Mapa mental ciclos de trabajo mciaMapa mental ciclos de trabajo mcia
Mapa mental ciclos de trabajo mcia
 

Similar to Week2 dq3

Java basic-data-types
Java basic-data-typesJava basic-data-types
Java basic-data-types
Shahid Rasheed
 
Java basic data types
Java basic data typesJava basic data types
Java basic data types
javaicon
 
Data Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docxData Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docx
theodorelove43763
 
02. Data Type and Variables
02. Data Type and Variables02. Data Type and Variables
02. Data Type and VariablesTommy Vercety
 
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
 
02 Primitive data types and variables
02 Primitive data types and variables02 Primitive data types and variables
02 Primitive data types and variables
maznabili
 
Python Programming | JNTUK | UNIT 1 | Lecture 4
Python Programming | JNTUK | UNIT 1 | Lecture 4Python Programming | JNTUK | UNIT 1 | Lecture 4
Python Programming | JNTUK | UNIT 1 | Lecture 4
FabMinds
 
Primitive Data Types and Variables Lesson 02
Primitive Data Types and Variables Lesson 02Primitive Data Types and Variables Lesson 02
Primitive Data Types and Variables Lesson 02
A-Tech and Software Development
 
Data Handling
Data HandlingData Handling
Data Handling
Praveen M Jigajinni
 
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
chinthala Vijaya Kumar
 
Data Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# ProgrammingData Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# Programming
Sherwin Banaag Sapin
 
Vhdl identifiers,data types
Vhdl identifiers,data typesVhdl identifiers,data types
Vhdl identifiers,data types
MadhuriMulik1
 
Data types in java
Data types in javaData types in java
Data types in java
HarshitaAshwani
 
L9 wrapper classes
L9 wrapper classesL9 wrapper classes
L9 wrapper classes
teach4uin
 
data handling revision.pptx
data handling revision.pptxdata handling revision.pptx
data handling revision.pptx
DeepaRavi21
 
Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and Operators
Marwa Ali Eissa
 
Variable
VariableVariable
Basic of java 2
Basic of java  2Basic of java  2
Basic of java 2
Vijay Kankane
 

Similar to Week2 dq3 (20)

Java basic-data-types
Java basic-data-typesJava basic-data-types
Java basic-data-types
 
Java basic data types
Java basic data typesJava basic data types
Java basic data types
 
Data Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docxData Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docx
 
02. Data Type and Variables
02. Data Type and Variables02. Data Type and Variables
02. Data Type and Variables
 
Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiers
 
02 Primitive data types and variables
02 Primitive data types and variables02 Primitive data types and variables
02 Primitive data types and variables
 
Python Programming | JNTUK | UNIT 1 | Lecture 4
Python Programming | JNTUK | UNIT 1 | Lecture 4Python Programming | JNTUK | UNIT 1 | Lecture 4
Python Programming | JNTUK | UNIT 1 | Lecture 4
 
Primitive Data Types and Variables Lesson 02
Primitive Data Types and Variables Lesson 02Primitive Data Types and Variables Lesson 02
Primitive Data Types and Variables Lesson 02
 
Data Handling
Data HandlingData Handling
Data Handling
 
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
 
Data Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# ProgrammingData Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# Programming
 
Vhdl identifiers,data types
Vhdl identifiers,data typesVhdl identifiers,data types
Vhdl identifiers,data types
 
Data types in java
Data types in javaData types in java
Data types in java
 
L9 wrapper classes
L9 wrapper classesL9 wrapper classes
L9 wrapper classes
 
data handling revision.pptx
data handling revision.pptxdata handling revision.pptx
data handling revision.pptx
 
M C6java2
M C6java2M C6java2
M C6java2
 
Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and Operators
 
7494608
74946087494608
7494608
 
Variable
VariableVariable
Variable
 
Basic of java 2
Basic of java  2Basic of java  2
Basic of java 2
 

More from amaxwell2012

Week3 dq4
Week3 dq4Week3 dq4
Week3 dq4
amaxwell2012
 
Week3 dq1
Week3 dq1Week3 dq1
Week3 dq1
amaxwell2012
 
Week2 dq4
Week2 dq4Week2 dq4
Week2 dq4
amaxwell2012
 
Week2 dq2
Week2 dq2Week2 dq2
Week2 dq2
amaxwell2012
 
Week1 dq5
Week1 dq5Week1 dq5
Week1 dq5
amaxwell2012
 
Week1 dq3
Week1 dq3Week1 dq3
Week1 dq3
amaxwell2012
 
Week1 dq2
Week1 dq2Week1 dq2
Week1 dq2
amaxwell2012
 
Week 4 dq 4
Week 4 dq 4Week 4 dq 4
Week 4 dq 4
amaxwell2012
 

More from amaxwell2012 (9)

Week3 dq4
Week3 dq4Week3 dq4
Week3 dq4
 
Week3 dq1
Week3 dq1Week3 dq1
Week3 dq1
 
Week2 dq4
Week2 dq4Week2 dq4
Week2 dq4
 
Week2 dq2
Week2 dq2Week2 dq2
Week2 dq2
 
Week1 dq5
Week1 dq5Week1 dq5
Week1 dq5
 
Week1 dq3
Week1 dq3Week1 dq3
Week1 dq3
 
Week1 dq2
Week1 dq2Week1 dq2
Week1 dq2
 
Week 4 dq 4
Week 4 dq 4Week 4 dq 4
Week 4 dq 4
 
Week 4 dq 3
Week 4 dq 3Week 4 dq 3
Week 4 dq 3
 

Week2 dq3

  • 1. Every variable must have a data type. A variable's data type determines the values that the variable can contain and the operations that can be performed on it. The Java programming language has two categories of data types: primitive and reference. Primitives are data types whose state represents a number, a character, or a true/false indication. Primitive types are not class types; they do not provide any behavior associated with the type appropriate values they hold. Java has eight primitive types that should look familiar to you from other languages: The table below lists some examples of primitive data types. int Integer 32-bit two’s 178 complement float Single-precision floating 32-bit IEEE 754 point char A single character 16-bit Unicode ‘c ’ character boolean A boolean value (true or true or false true false) false Reference types in Java are Classes, Interfaces, and Arrays. When you declare a reference type variable you are specifying that the variable will refer, or point to an object, instead of holding a single value as a primitive type. Here's an example of declaring an integer variable: int maxLoginAttempts = 3;
  • 2. When you create a variable in Java, you must know a few things: • You must know what data type you are going to use. • You must know what you want to call the variable. • You might also want to know the value with which the variable should be initialized.