SlideShare a Scribd company logo
Primitive Data Types
• The Java programming language is statically-
typed, which means that all variables must
first be declared before they can be used.
• This involves stating the variable's type and
name, as like below:
• int a ;
• a= 1;
Primitive Data Types
• The eight primitive data types supported by the Java programming
language are:
• Byte
• Short
• Int
• Long
• Float
• Double
• Boolean
• Char
• In addition to the eight primitive data types listed above, the Java
programming language also provides special support for character
strings via the java.lang.String class.
Primitive Data Types
• byte: The byte data type is an 8-bit signed two's
complement integer.
• It has a minimum value of -128 and a maximum
value of 127 (inclusive).
• The byte data type can be useful for saving
memory in large arrays, where the memory
savings actually matters.
• They can also be used in place of int where their
limits help to clarify your code; the fact that a
variable's range is limited can serve as a form of
documentation.
Primitive Data Types
• short: The short data type is a 16-bit signed
two's complement integer.
• It has a minimum value of -32,768 and a
maximum value of 32,767 (inclusive).
• As with byte, the same guidelines apply: you
can use a short to save memory in large
arrays, in situations where the memory
savings actually matters.
Primitive Data Types
• int: By default, the int data type is a 32-bit signed
two's complement integer, which has a minimum
value of -231 and a maximum value of 231-1.
• In Java SE 8 and later, you can use the int data type to
represent an unsigned 32-bit integer, which has a
minimum value of 0 and a maximum value of 232-1.
• Use the Integer class to use int data type as an
unsigned integer. Static methods like
compareUnsigned, divideUnsigned etc have been
added to the Integer class to support the arithmetic
operations for unsigned integers.
Primitive Data Types
• long: The long data type is a 64-bit two's complement
integer.
• The signed long has a minimum value of -263 and a
maximum value of 263-1.
• In Java SE 8 and later, you can use the long data type
to represent an unsigned 64-bit long, which has a
minimum value of 0 and a maximum value of 264-1.
• Use this data type when you need a range of values
wider than those provided by int.
• The Long class also contains methods like
compareUnsigned, divideUnsigned etc to support
arithmetic operations for unsigned long.
Primitive Data Types
• float: The float data type is a single-precision 32-
bit floating point.
• As with the recommendations for byte and short,
use a float (instead of double) if you need to save
memory in large arrays of floating point numbers.
• This data type should never be used for precise
values, such as currency. For that, you will need
to use the java.math.BigDecimal class instead.
Primitive Data Types
• double: The double data type is a double-
precision 64-bit floating point.
• For decimal values, this data type is generally
the default choice. As mentioned above, this
data type should never be used for precise
values, such as currency.
Primitive Data Types
• boolean: The boolean data type has only two
possible values: true and false.
• Use this data type for simple flags that track
true/false conditions.
• This data type represents one bit of
information, but its "size" isn't something
that's precisely defined.
Primitive Data Types
• char: The char data type is a single 16-bit
Unicode character.
• It has a minimum value of 'u0000' (or 0) and
a maximum value of 'uffff' (or 65,535
inclusive).
Primitive Data Types
• String s = "this is a string";. String objects are
immutable, which means that once created,
their values cannot be changed.
• The String class is not technically a primitive
data type.
Primitive Data Types
Primitive Data Types
Arrays
• An array is a container object that holds a
fixed number of values of a single type.
• The length of an array is established when the
array is created.
• After creation, its length is fixed.
• You have seen an example of arrays already, in
the main method of the "Hello World!"
application.
Arrays
An array of 10 elements.
Each item in an array is called an element, and each
element is accessed by its numerical index. As shown in
the above illustration, numbering begins with 0. The 9th
element, for example, would therefore be accessed at
index 8.
What's the difference between an
argument and a parameter?
• A parameter is a variable in a method
declaration.
• When a method is called, the arguments are
the data you pass into the method's
parameters.
• public void MyMethod(string myParam) { }
• ...
• string myArg1 = "this is my argument";
myClass.MyMethod(myArg1);
What's the difference between an
argument and a parameter?
• Arguments are Actual.
• You define parameters, and you make
arguments.
• The thematic role of an argument is agent.
The thematic role of parameter is recipient.
• C/C++ documentation often refers to function
parameters as formal arguments and function
call arguments as actual arguments.
What's the difference between an
argument and a parameter?
• // Define a method with two parameters
• int Sum(int num1, int num2) {
• return num1 + num2;
• }
• // Call the method using two arguments
• var ret = Sum(2, 3);

More Related Content

What's hot

Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and Operators
Marwa Ali Eissa
 
M C6java3
M C6java3M C6java3
M C6java3
mbruggen
 
ITFT - Java
ITFT - JavaITFT - Java
ITFT - Java
Blossom Sood
 
Learning core java
Learning core javaLearning core java
Learning core java
Abhay Bharti
 
Datatype introduction- JAVA
Datatype introduction- JAVADatatype introduction- JAVA
Datatype introduction- JAVA
Hamna_sheikh
 
Quick Scala
Quick ScalaQuick Scala
Quick Scala
Puneet Kumar
 
M C6java2
M C6java2M C6java2
M C6java2
mbruggen
 
Datatype
DatatypeDatatype
Datatype
baran19901990
 
Introduction to objects and inputoutput
Introduction to objects and inputoutput Introduction to objects and inputoutput
Introduction to objects and inputoutput
Ahmad Idrees
 
Lecture02 java
Lecture02 javaLecture02 java
Lecture02 java
jawidAhmadRohani
 
5variables in c#
5variables in c#5variables in c#
5variables in c#
Sireesh K
 
C#
C#C#
Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2
Jamshid Hashimi
 
Pj01 3-java-variable and data types
Pj01 3-java-variable and data typesPj01 3-java-variable and data types
Pj01 3-java-variable and data types
SasidharaRaoMarrapu
 
Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1
Jamshid Hashimi
 
Generics of JAVA
Generics of JAVAGenerics of JAVA
Generics of JAVA
Jai Marathe
 
Data types, Variables, Expressions & Arithmetic Operators in java
Data types, Variables, Expressions & Arithmetic Operators in javaData types, Variables, Expressions & Arithmetic Operators in java
Data types, Variables, Expressions & Arithmetic Operators in java
Javed Rashid
 
M C6java7
M C6java7M C6java7
M C6java7
mbruggen
 
Data types in python
Data types in pythonData types in python
Data types in python
Learnbay Datascience
 
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
 

What's hot (20)

Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and Operators
 
M C6java3
M C6java3M C6java3
M C6java3
 
ITFT - Java
ITFT - JavaITFT - Java
ITFT - Java
 
Learning core java
Learning core javaLearning core java
Learning core java
 
Datatype introduction- JAVA
Datatype introduction- JAVADatatype introduction- JAVA
Datatype introduction- JAVA
 
Quick Scala
Quick ScalaQuick Scala
Quick Scala
 
M C6java2
M C6java2M C6java2
M C6java2
 
Datatype
DatatypeDatatype
Datatype
 
Introduction to objects and inputoutput
Introduction to objects and inputoutput Introduction to objects and inputoutput
Introduction to objects and inputoutput
 
Lecture02 java
Lecture02 javaLecture02 java
Lecture02 java
 
5variables in c#
5variables in c#5variables in c#
5variables in c#
 
C#
C#C#
C#
 
Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2
 
Pj01 3-java-variable and data types
Pj01 3-java-variable and data typesPj01 3-java-variable and data types
Pj01 3-java-variable and data types
 
Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1
 
Generics of JAVA
Generics of JAVAGenerics of JAVA
Generics of JAVA
 
Data types, Variables, Expressions & Arithmetic Operators in java
Data types, Variables, Expressions & Arithmetic Operators in javaData types, Variables, Expressions & Arithmetic Operators in java
Data types, Variables, Expressions & Arithmetic Operators in java
 
M C6java7
M C6java7M C6java7
M C6java7
 
Data types in python
Data types in pythonData types in python
Data types in python
 
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
 

Viewers also liked

Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Ajay Sharma
 
New syntax elements of java 7
New syntax elements of java 7New syntax elements of java 7
New syntax elements of java 7
Orange and Bronze Software Labs
 
Jvm fundamentals
Jvm fundamentalsJvm fundamentals
Jvm fundamentals
Miguel Pastor
 
Java basic data types
Java basic data typesJava basic data types
Java basic data types
javaicon
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
Paul Pajo
 
Java Basic Syntax
Java Basic SyntaxJava Basic Syntax
Java Basic Syntax
javaicon
 
02 data types in java
02 data types in java02 data types in java
02 data types in java
রাকিন রাকিন
 
Java Basics
Java BasicsJava Basics
Java Basics
Emprovise
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data Types
Tareq Hasan
 
Introduction to Remote Method Invocation (RMI)
Introduction to Remote Method Invocation (RMI)Introduction to Remote Method Invocation (RMI)
Introduction to Remote Method Invocation (RMI)
eLink Business Innovations
 
Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)
Peter R. Egli
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
Sagar Pednekar
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
kamal kotecha
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
Pokequesthero
 
Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674
Lokesh Kakkar Mobile No. 814-614-5674
 
Robot Framework Introduction
Robot Framework IntroductionRobot Framework Introduction
Robot Framework Introduction
Pekka Klärck
 

Viewers also liked (16)

Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
New syntax elements of java 7
New syntax elements of java 7New syntax elements of java 7
New syntax elements of java 7
 
Jvm fundamentals
Jvm fundamentalsJvm fundamentals
Jvm fundamentals
 
Java basic data types
Java basic data typesJava basic data types
Java basic data types
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
Java Basic Syntax
Java Basic SyntaxJava Basic Syntax
Java Basic Syntax
 
02 data types in java
02 data types in java02 data types in java
02 data types in java
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data Types
 
Introduction to Remote Method Invocation (RMI)
Introduction to Remote Method Invocation (RMI)Introduction to Remote Method Invocation (RMI)
Introduction to Remote Method Invocation (RMI)
 
Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674
 
Robot Framework Introduction
Robot Framework IntroductionRobot Framework Introduction
Robot Framework Introduction
 

Similar to Variable

CS4443 - Modern Programming Language - I Lecture (2)
CS4443 - Modern Programming Language - I  Lecture (2)CS4443 - Modern Programming Language - I  Lecture (2)
CS4443 - Modern Programming Language - I Lecture (2)
Dilawar Khan
 
Java session3
Java session3Java session3
Java session3
Jigarthacker
 
Data types
Data typesData types
Data types
Dr. Rupinder Singh
 
CIS 1403 Lab 2- Data Types and Variables
CIS 1403 Lab 2- Data Types and VariablesCIS 1403 Lab 2- Data Types and Variables
CIS 1403 Lab 2- Data Types and Variables
Hamad Odhabi
 
01 Java Language And OOP PART I
01 Java Language And OOP PART I01 Java Language And OOP PART I
01 Java Language And OOP PART I
Hari Christian
 
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptxQ-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
kalai75
 
Data types ,variables,array
Data types ,variables,arrayData types ,variables,array
Data types ,variables,array
Gujarat Technological University
 
Java Tutorial Lab 2
Java Tutorial Lab 2Java Tutorial Lab 2
Java Tutorial Lab 2
Berk Soysal
 
Computer Sience, This is my presentation for beginners coding in python
Computer Sience, This is my presentation for beginners coding in pythonComputer Sience, This is my presentation for beginners coding in python
Computer Sience, This is my presentation for beginners coding in python
alin173596
 
data science with python_UNIT 2_full notes.pdf
data science with python_UNIT 2_full notes.pdfdata science with python_UNIT 2_full notes.pdf
data science with python_UNIT 2_full notes.pdf
mukeshgarg02
 
C++ data types
C++ data typesC++ data types
C++ data types
pratikborsadiya
 
Variables&DataTypes.pptx
Variables&DataTypes.pptxVariables&DataTypes.pptx
Variables&DataTypes.pptx
sanjanaMudduluru1
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
marvellous2
 
Data types slides by Faixan
Data types slides by FaixanData types slides by Faixan
Data types slides by Faixan
ٖFaiXy :)
 
data types in C programming
data types in C programmingdata types in C programming
data types in C programming
Harshita Yadav
 
cassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfcassignmentii-170424105623.pdf
cassignmentii-170424105623.pdf
YRABHI
 
12.6-12.9.pptx
12.6-12.9.pptx12.6-12.9.pptx
12.6-12.9.pptx
WinterSnow16
 
5. variables & data types
5. variables & data types5. variables & data types
5. variables & data types
M H Buddhika Ariyaratne
 
JAVA LESSON-01.pptx
JAVA LESSON-01.pptxJAVA LESSON-01.pptx
JAVA LESSON-01.pptx
StephenOczon1
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
TamalSengupta8
 

Similar to Variable (20)

CS4443 - Modern Programming Language - I Lecture (2)
CS4443 - Modern Programming Language - I  Lecture (2)CS4443 - Modern Programming Language - I  Lecture (2)
CS4443 - Modern Programming Language - I Lecture (2)
 
Java session3
Java session3Java session3
Java session3
 
Data types
Data typesData types
Data types
 
CIS 1403 Lab 2- Data Types and Variables
CIS 1403 Lab 2- Data Types and VariablesCIS 1403 Lab 2- Data Types and Variables
CIS 1403 Lab 2- Data Types and Variables
 
01 Java Language And OOP PART I
01 Java Language And OOP PART I01 Java Language And OOP PART I
01 Java Language And OOP PART I
 
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptxQ-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
 
Data types ,variables,array
Data types ,variables,arrayData types ,variables,array
Data types ,variables,array
 
Java Tutorial Lab 2
Java Tutorial Lab 2Java Tutorial Lab 2
Java Tutorial Lab 2
 
Computer Sience, This is my presentation for beginners coding in python
Computer Sience, This is my presentation for beginners coding in pythonComputer Sience, This is my presentation for beginners coding in python
Computer Sience, This is my presentation for beginners coding in python
 
data science with python_UNIT 2_full notes.pdf
data science with python_UNIT 2_full notes.pdfdata science with python_UNIT 2_full notes.pdf
data science with python_UNIT 2_full notes.pdf
 
C++ data types
C++ data typesC++ data types
C++ data types
 
Variables&DataTypes.pptx
Variables&DataTypes.pptxVariables&DataTypes.pptx
Variables&DataTypes.pptx
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Data types slides by Faixan
Data types slides by FaixanData types slides by Faixan
Data types slides by Faixan
 
data types in C programming
data types in C programmingdata types in C programming
data types in C programming
 
cassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfcassignmentii-170424105623.pdf
cassignmentii-170424105623.pdf
 
12.6-12.9.pptx
12.6-12.9.pptx12.6-12.9.pptx
12.6-12.9.pptx
 
5. variables & data types
5. variables & data types5. variables & data types
5. variables & data types
 
JAVA LESSON-01.pptx
JAVA LESSON-01.pptxJAVA LESSON-01.pptx
JAVA LESSON-01.pptx
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
 

Recently uploaded

学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
Aditya Rajan Patra
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 

Recently uploaded (20)

学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 

Variable

  • 1.
  • 2. Primitive Data Types • The Java programming language is statically- typed, which means that all variables must first be declared before they can be used. • This involves stating the variable's type and name, as like below: • int a ; • a= 1;
  • 3. Primitive Data Types • The eight primitive data types supported by the Java programming language are: • Byte • Short • Int • Long • Float • Double • Boolean • Char • In addition to the eight primitive data types listed above, the Java programming language also provides special support for character strings via the java.lang.String class.
  • 4. Primitive Data Types • byte: The byte data type is an 8-bit signed two's complement integer. • It has a minimum value of -128 and a maximum value of 127 (inclusive). • The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters. • They can also be used in place of int where their limits help to clarify your code; the fact that a variable's range is limited can serve as a form of documentation.
  • 5. Primitive Data Types • short: The short data type is a 16-bit signed two's complement integer. • It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). • As with byte, the same guidelines apply: you can use a short to save memory in large arrays, in situations where the memory savings actually matters.
  • 6. Primitive Data Types • int: By default, the int data type is a 32-bit signed two's complement integer, which has a minimum value of -231 and a maximum value of 231-1. • In Java SE 8 and later, you can use the int data type to represent an unsigned 32-bit integer, which has a minimum value of 0 and a maximum value of 232-1. • Use the Integer class to use int data type as an unsigned integer. Static methods like compareUnsigned, divideUnsigned etc have been added to the Integer class to support the arithmetic operations for unsigned integers.
  • 7. Primitive Data Types • long: The long data type is a 64-bit two's complement integer. • The signed long has a minimum value of -263 and a maximum value of 263-1. • In Java SE 8 and later, you can use the long data type to represent an unsigned 64-bit long, which has a minimum value of 0 and a maximum value of 264-1. • Use this data type when you need a range of values wider than those provided by int. • The Long class also contains methods like compareUnsigned, divideUnsigned etc to support arithmetic operations for unsigned long.
  • 8. Primitive Data Types • float: The float data type is a single-precision 32- bit floating point. • As with the recommendations for byte and short, use a float (instead of double) if you need to save memory in large arrays of floating point numbers. • This data type should never be used for precise values, such as currency. For that, you will need to use the java.math.BigDecimal class instead.
  • 9. Primitive Data Types • double: The double data type is a double- precision 64-bit floating point. • For decimal values, this data type is generally the default choice. As mentioned above, this data type should never be used for precise values, such as currency.
  • 10. Primitive Data Types • boolean: The boolean data type has only two possible values: true and false. • Use this data type for simple flags that track true/false conditions. • This data type represents one bit of information, but its "size" isn't something that's precisely defined.
  • 11. Primitive Data Types • char: The char data type is a single 16-bit Unicode character. • It has a minimum value of 'u0000' (or 0) and a maximum value of 'uffff' (or 65,535 inclusive).
  • 12. Primitive Data Types • String s = "this is a string";. String objects are immutable, which means that once created, their values cannot be changed. • The String class is not technically a primitive data type.
  • 15. Arrays • An array is a container object that holds a fixed number of values of a single type. • The length of an array is established when the array is created. • After creation, its length is fixed. • You have seen an example of arrays already, in the main method of the "Hello World!" application.
  • 16. Arrays An array of 10 elements. Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the above illustration, numbering begins with 0. The 9th element, for example, would therefore be accessed at index 8.
  • 17. What's the difference between an argument and a parameter? • A parameter is a variable in a method declaration. • When a method is called, the arguments are the data you pass into the method's parameters. • public void MyMethod(string myParam) { } • ... • string myArg1 = "this is my argument"; myClass.MyMethod(myArg1);
  • 18. What's the difference between an argument and a parameter? • Arguments are Actual. • You define parameters, and you make arguments. • The thematic role of an argument is agent. The thematic role of parameter is recipient. • C/C++ documentation often refers to function parameters as formal arguments and function call arguments as actual arguments.
  • 19. What's the difference between an argument and a parameter? • // Define a method with two parameters • int Sum(int num1, int num2) { • return num1 + num2; • } • // Call the method using two arguments • var ret = Sum(2, 3);