SlideShare a Scribd company logo
1 of 26
Download to read offline
TUNASAN NATIONAL HIGH SCHOOL
SDO - Muntinlupa City
ROWELL L. MARQUINA
Senior High School Teacher
TUNASAN NATIONAL HIGH SCHOOL
Lesson 4 - Java Programming
LEARNING OBJECTIVES:
At the end of the session, you will be able to:
1. define data and data type;
2. categorize data according to
classifications;
3. discuss what is a variable and its
importance; and
4. declare and initialize variables and
use it in a Java program.
Data in programming refers
to information can be stored,
processed, and generated by
a computer system.
WHAT IS DATA?
IMAGE SOURCE:
https://images.datacamp.com/image/upload/v1652357545/shutterstock_1770654182_d43667c1bc.jpg
It is characterized by its
capacity to:
▪ be transformed to other
type of information
▪ to be transmitted to other
computer systems.
Examples of Data:
▪ Name
▪ Date of Birth
▪ Sex/Gender
▪ Address
▪ Cell Phone Number
▪ Serial Number
▪ Email Address
▪ String of Letters or Numbers
▪ A Yes/No Answer
WHAT IS DATA?
IMAGE SOURCE:
https://images.datacamp.com/image/upload/v1652357545/shutterstock_1770654182_d43667c1bc.jpg
When a data is inputted in
computer system for processing, it
will be entered in the system’s
memory unit for either temporary
or permanent storage.
WHAT IS DATA?
IMAGE SOURCE: https://learningc.org/_images/memory-pieces.png
Depending on its size and data
type, it will be assigned to occupy a
specific space in the storage unit
which are identified using memory
address.
Data type refers to the classification of data that tells the
program what type of information it is getting and how it
will be processed.
WHAT IS DATA TYPE?
IMAGE SOURCE: https://techvidvan.com/tutorials/wp-content/uploads/sites/2/2020/02/primitive-data-
types-in-java.jpg
There are 8 fundamental data types used in Java.
WHAT IS DATA TYPE?
byte refers to integers that ranges from -128 to 127
short refers to integers that ranges from -32,768 to 32,767
int refers to integers that ranges from -2,147,483,648 to 2,147,483,647
long
refers to integers that ranges from -9,223,372,036,854,775,808 to
9,223,372,036,854,775,807
There are 8 fundamental data types used in Java.
WHAT IS DATA TYPE?
float
refers to decimal numbers that has a precision of up to 7-digits
after the decimal point.
double
refers to decimal numbers that has a precision of up to 15-digits
after the decimal point.
char
refers to a data type that is used to store a single character. It can
be a single letter, number, or symbol.
boolean
refers to the data type that can only store any of the two reserved
values of either true or false.
A variable is a name or label
assigned by a programmer for a
data container located in the
memory unit.
Using variable enables programmers
to label a memory allocation with a
more readable and recognizable
name rather than its actual memory
address for easier referencing.
WHAT IS A VARIABLE?
IMAGE SOURCE: https://www.startertutorials.com/corejava/wp-content/uploads/2014/09/Java-Variable.jpg
▪ The length of the variable name
must be at least one character.
▪ It must not be a keyword used by
Java such as print, println, system,
include, int, float, and String to
name a few.
▪ It should start with a either a letter,
dollar sign ($), or underscore (_).
▪ It must not start with a number.
NAMING CONVENTIONS:
IMAGE SOURCE: https://www.startertutorials.com/corejava/wp-content/uploads/2014/09/Java-Variable.jpg
▪ Be mindful of your casing
because Java is case-sensitive.
▪ Must not include a whitespace or
blank instead the user can use
an underscore.
NAMING CONVENTIONS:
IMAGE SOURCE: https://www.startertutorials.com/corejava/wp-content/uploads/2014/09/Java-Variable.jpg
CHECKPOINT:
Which of these variable names
are acceptable? Why / Why not?
▪ num 1
▪ BirthMonth
▪ 1stnum
▪ $num
▪ systemx
▪ 1st_Year
▪ employee_name
▪ product code
VARIABLE DECLARATION
A variable declaration is a Java statement that
instructs the program to assign a name or label to a
specific memory location in the computer. It also
informs the program what type of data that the
memory location shall contain.
VARIABLE DECLARATION
Data Type Variable Name
Separator
When declaring variables that are consists of
different data types, each variable must be declared
individually separated by a semicolon.
VARIABLE DECLARATION
When declaring variables that are consists of similar
data types, all the variables can be declared
altogether in one line but are separated by commas.
VARIABLE DECLARATION
Regardless of the similarity or
differences of the data type,
programmers can still opt to
declare their variables in
individually. It is done most likely
for the purpose of readability.
VARIABLE DECLARATION
It is important to note that since
variables are declared individually,
each declaration must be
separated by a semicolon.
A variable initialization is a Java statement that
declares a variable with an initial value. It allows the
memory location to start with an initial data.
VARIABLE INITIALIZATION
VARIABLE INITIALIZATION
Data Type Variable Name
Assignment Operator
Initial Value
Separator
Important notes when declaring
or initializing a variable:
▪ Only the String data type is
written with its first letter
uppercased, the rest of the
data types are written in
lowercase.
▪ The String value is initiated
by enclosing it value inside
quotation marks (“).
VARIABLE INITIALIZATION
Important notes when
declaring or initializing a
variable:
▪ The integer and
double values are
declared “as is”.
▪ The character is
declared by enclosing
its value with a single
quote (‘).
VARIABLE INITIALIZATION
CHECKPOINT:
Which of these variable
declarations / initializations are
acceptable? Why / Why not?
▪ String sport = ‘basketball’;
▪ int weight = “52”;
▪ double math_grade = 95.39;
▪ String color = blue;
▪ Double gravity = 9.8;
▪ int speed = 8.56;
▪ String dog_breed = Shih Tzu
DATA AND VARIABLES
MR. ROWELL L. MARQUINA
Tunasan National High School
Senior High School Department
Email Address:
rowell.marquina001@deped.gov.ph
sirrowellmarquina@gmail.com
rmarquina@mitis.edu.ph

More Related Content

What's hot

Empowerment Technology Lesson 3
Empowerment Technology Lesson 3Empowerment Technology Lesson 3
Empowerment Technology Lesson 3alicelagajino
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machineNikhil Sharma
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java ProgrammingMath-Circle
 
Programming Java NCIII Budget of Work
Programming Java NCIII Budget of WorkProgramming Java NCIII Budget of Work
Programming Java NCIII Budget of WorkFernando Enad
 
Basic Concepts of Animation
Basic Concepts of AnimationBasic Concepts of Animation
Basic Concepts of Animationjamalharun
 
Server Add-ons for Front-end Developers
Server Add-ons for Front-end DevelopersServer Add-ons for Front-end Developers
Server Add-ons for Front-end DevelopersAtlassian
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technologysshhzap
 
C Programming- Features of C language
C Programming-  Features of C languageC Programming-  Features of C language
C Programming- Features of C languageTrinity Dwarka
 
SULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN BASHA
 
Learn C# Programming - Variables & Constants
Learn C# Programming - Variables & ConstantsLearn C# Programming - Variables & Constants
Learn C# Programming - Variables & ConstantsEng Teong Cheah
 
canva presentation
canva presentationcanva presentation
canva presentationZainabAya
 

What's hot (20)

Simple Java Programs
Simple Java ProgramsSimple Java Programs
Simple Java Programs
 
Empowerment Technology Lesson 3
Empowerment Technology Lesson 3Empowerment Technology Lesson 3
Empowerment Technology Lesson 3
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
 
Programming Java NCIII Budget of Work
Programming Java NCIII Budget of WorkProgramming Java NCIII Budget of Work
Programming Java NCIII Budget of Work
 
Basic Concepts of Animation
Basic Concepts of AnimationBasic Concepts of Animation
Basic Concepts of Animation
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 
Server Add-ons for Front-end Developers
Server Add-ons for Front-end DevelopersServer Add-ons for Front-end Developers
Server Add-ons for Front-end Developers
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technology
 
C Programming- Features of C language
C Programming-  Features of C languageC Programming-  Features of C language
C Programming- Features of C language
 
SULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notes
 
Java
JavaJava
Java
 
1. introduction to python
1. introduction to python1. introduction to python
1. introduction to python
 
How to Use Canva
How to Use CanvaHow to Use Canva
How to Use Canva
 
Java History
Java HistoryJava History
Java History
 
Learn C# Programming - Variables & Constants
Learn C# Programming - Variables & ConstantsLearn C# Programming - Variables & Constants
Learn C# Programming - Variables & Constants
 
Java program structure
Java program structureJava program structure
Java program structure
 
Java features
Java featuresJava features
Java features
 
Introduction to Java Scripting
Introduction to Java ScriptingIntroduction to Java Scripting
Introduction to Java Scripting
 
canva presentation
canva presentationcanva presentation
canva presentation
 

Similar to Lesson 4 - Data and Variables.pdf

Similar to Lesson 4 - Data and Variables.pdf (20)

Java data types, variables and jvm
Java data types, variables and jvm Java data types, variables and jvm
Java data types, variables and jvm
 
OOP Poster Presentation
OOP Poster PresentationOOP Poster Presentation
OOP Poster Presentation
 
Java unit 2
Java unit 2Java unit 2
Java unit 2
 
Variables And Data Types
Variables And Data TypesVariables And Data Types
Variables And Data Types
 
Concepts of core java
Concepts of core javaConcepts of core java
Concepts of core java
 
Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1
 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
 
Handling Data in Algorithm
Handling Data in AlgorithmHandling Data in Algorithm
Handling Data in Algorithm
 
Unit 4 rdbms study_material
Unit 4  rdbms study_materialUnit 4  rdbms study_material
Unit 4 rdbms study_material
 
Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and Operators
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
Core java
Core javaCore java
Core java
 
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptxINDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
 
Basic
BasicBasic
Basic
 
java handout.doc
java handout.docjava handout.doc
java handout.doc
 
Java Jive 002.pptx
Java Jive 002.pptxJava Jive 002.pptx
Java Jive 002.pptx
 
7-Java Language Basics Part1
7-Java Language Basics Part17-Java Language Basics Part1
7-Java Language Basics Part1
 
Chapter 3.1
Chapter 3.1Chapter 3.1
Chapter 3.1
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Java basic
Java basicJava basic
Java basic
 

More from ROWELL MARQUINA

QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfROWELL MARQUINA
 
QMMS Lesson 2 - Using Excel Formula.pptx
QMMS Lesson 2 - Using Excel Formula.pptxQMMS Lesson 2 - Using Excel Formula.pptx
QMMS Lesson 2 - Using Excel Formula.pptxROWELL MARQUINA
 
HCI Lesson 2 - Components of Human-Computer Interaction (HCI).pdf
HCI Lesson 2 - Components of Human-Computer Interaction (HCI).pdfHCI Lesson 2 - Components of Human-Computer Interaction (HCI).pdf
HCI Lesson 2 - Components of Human-Computer Interaction (HCI).pdfROWELL MARQUINA
 
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdfHCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdfROWELL MARQUINA
 
DS Lesson 2 - Subsets, Supersets and Power Set.pdf
DS Lesson 2 - Subsets, Supersets and Power Set.pdfDS Lesson 2 - Subsets, Supersets and Power Set.pdf
DS Lesson 2 - Subsets, Supersets and Power Set.pdfROWELL MARQUINA
 
ITSP Lesson 6 - Information Privacy.pdf
ITSP Lesson 6 - Information Privacy.pdfITSP Lesson 6 - Information Privacy.pdf
ITSP Lesson 6 - Information Privacy.pdfROWELL MARQUINA
 
ITSP Lesson 5 - Intellectual Property Rights.pdf
ITSP Lesson 5 - Intellectual Property Rights.pdfITSP Lesson 5 - Intellectual Property Rights.pdf
ITSP Lesson 5 - Intellectual Property Rights.pdfROWELL MARQUINA
 
ITSP Lesson 1 - Ethics and Ethical Theories.pdf
ITSP Lesson 1 - Ethics and Ethical Theories.pdfITSP Lesson 1 - Ethics and Ethical Theories.pdf
ITSP Lesson 1 - Ethics and Ethical Theories.pdfROWELL MARQUINA
 
ITSP Lesson 1 - Ethics and Ethical Theories.pdf
ITSP Lesson 1 - Ethics and Ethical Theories.pdfITSP Lesson 1 - Ethics and Ethical Theories.pdf
ITSP Lesson 1 - Ethics and Ethical Theories.pdfROWELL MARQUINA
 
CHF Lesson 2 - Software and Software Categories.pdf
CHF Lesson 2 - Software and Software Categories.pdfCHF Lesson 2 - Software and Software Categories.pdf
CHF Lesson 2 - Software and Software Categories.pdfROWELL MARQUINA
 
Animation Lesson 4 - Tools and Equipment in Animation.pdf
Animation Lesson 4 - Tools and Equipment in Animation.pdfAnimation Lesson 4 - Tools and Equipment in Animation.pdf
Animation Lesson 4 - Tools and Equipment in Animation.pdfROWELL MARQUINA
 
DSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdfDSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdfROWELL MARQUINA
 
DSA Lesson 1 - Introduction to Data Structures.pdf
DSA Lesson 1 - Introduction to Data Structures.pdfDSA Lesson 1 - Introduction to Data Structures.pdf
DSA Lesson 1 - Introduction to Data Structures.pdfROWELL MARQUINA
 
Animation Lesson 3 - Occupational Health and Safety Procedures.pdf
Animation Lesson 3 - Occupational Health and Safety Procedures.pdfAnimation Lesson 3 - Occupational Health and Safety Procedures.pdf
Animation Lesson 3 - Occupational Health and Safety Procedures.pdfROWELL MARQUINA
 
Animation Lesson 2 - Environment and Market (Updated).pdf
Animation Lesson 2 - Environment and Market (Updated).pdfAnimation Lesson 2 - Environment and Market (Updated).pdf
Animation Lesson 2 - Environment and Market (Updated).pdfROWELL MARQUINA
 
Animation Lesson 3 - Occupational Health and Safety Procedures.pdf
Animation Lesson 3 - Occupational Health and Safety Procedures.pdfAnimation Lesson 3 - Occupational Health and Safety Procedures.pdf
Animation Lesson 3 - Occupational Health and Safety Procedures.pdfROWELL MARQUINA
 
Personal Entrepreneurial Competencies (PECs).pdf
Personal Entrepreneurial Competencies (PECs).pdfPersonal Entrepreneurial Competencies (PECs).pdf
Personal Entrepreneurial Competencies (PECs).pdfROWELL MARQUINA
 
Environment and Market.pdf
Environment and Market.pdfEnvironment and Market.pdf
Environment and Market.pdfROWELL MARQUINA
 
Lesson 5 - Getting Input from Users.pdf
Lesson 5 - Getting Input from Users.pdfLesson 5 - Getting Input from Users.pdf
Lesson 5 - Getting Input from Users.pdfROWELL MARQUINA
 

More from ROWELL MARQUINA (19)

QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdf
 
QMMS Lesson 2 - Using Excel Formula.pptx
QMMS Lesson 2 - Using Excel Formula.pptxQMMS Lesson 2 - Using Excel Formula.pptx
QMMS Lesson 2 - Using Excel Formula.pptx
 
HCI Lesson 2 - Components of Human-Computer Interaction (HCI).pdf
HCI Lesson 2 - Components of Human-Computer Interaction (HCI).pdfHCI Lesson 2 - Components of Human-Computer Interaction (HCI).pdf
HCI Lesson 2 - Components of Human-Computer Interaction (HCI).pdf
 
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdfHCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
 
DS Lesson 2 - Subsets, Supersets and Power Set.pdf
DS Lesson 2 - Subsets, Supersets and Power Set.pdfDS Lesson 2 - Subsets, Supersets and Power Set.pdf
DS Lesson 2 - Subsets, Supersets and Power Set.pdf
 
ITSP Lesson 6 - Information Privacy.pdf
ITSP Lesson 6 - Information Privacy.pdfITSP Lesson 6 - Information Privacy.pdf
ITSP Lesson 6 - Information Privacy.pdf
 
ITSP Lesson 5 - Intellectual Property Rights.pdf
ITSP Lesson 5 - Intellectual Property Rights.pdfITSP Lesson 5 - Intellectual Property Rights.pdf
ITSP Lesson 5 - Intellectual Property Rights.pdf
 
ITSP Lesson 1 - Ethics and Ethical Theories.pdf
ITSP Lesson 1 - Ethics and Ethical Theories.pdfITSP Lesson 1 - Ethics and Ethical Theories.pdf
ITSP Lesson 1 - Ethics and Ethical Theories.pdf
 
ITSP Lesson 1 - Ethics and Ethical Theories.pdf
ITSP Lesson 1 - Ethics and Ethical Theories.pdfITSP Lesson 1 - Ethics and Ethical Theories.pdf
ITSP Lesson 1 - Ethics and Ethical Theories.pdf
 
CHF Lesson 2 - Software and Software Categories.pdf
CHF Lesson 2 - Software and Software Categories.pdfCHF Lesson 2 - Software and Software Categories.pdf
CHF Lesson 2 - Software and Software Categories.pdf
 
Animation Lesson 4 - Tools and Equipment in Animation.pdf
Animation Lesson 4 - Tools and Equipment in Animation.pdfAnimation Lesson 4 - Tools and Equipment in Animation.pdf
Animation Lesson 4 - Tools and Equipment in Animation.pdf
 
DSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdfDSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdf
 
DSA Lesson 1 - Introduction to Data Structures.pdf
DSA Lesson 1 - Introduction to Data Structures.pdfDSA Lesson 1 - Introduction to Data Structures.pdf
DSA Lesson 1 - Introduction to Data Structures.pdf
 
Animation Lesson 3 - Occupational Health and Safety Procedures.pdf
Animation Lesson 3 - Occupational Health and Safety Procedures.pdfAnimation Lesson 3 - Occupational Health and Safety Procedures.pdf
Animation Lesson 3 - Occupational Health and Safety Procedures.pdf
 
Animation Lesson 2 - Environment and Market (Updated).pdf
Animation Lesson 2 - Environment and Market (Updated).pdfAnimation Lesson 2 - Environment and Market (Updated).pdf
Animation Lesson 2 - Environment and Market (Updated).pdf
 
Animation Lesson 3 - Occupational Health and Safety Procedures.pdf
Animation Lesson 3 - Occupational Health and Safety Procedures.pdfAnimation Lesson 3 - Occupational Health and Safety Procedures.pdf
Animation Lesson 3 - Occupational Health and Safety Procedures.pdf
 
Personal Entrepreneurial Competencies (PECs).pdf
Personal Entrepreneurial Competencies (PECs).pdfPersonal Entrepreneurial Competencies (PECs).pdf
Personal Entrepreneurial Competencies (PECs).pdf
 
Environment and Market.pdf
Environment and Market.pdfEnvironment and Market.pdf
Environment and Market.pdf
 
Lesson 5 - Getting Input from Users.pdf
Lesson 5 - Getting Input from Users.pdfLesson 5 - Getting Input from Users.pdf
Lesson 5 - Getting Input from Users.pdf
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 

Recently uploaded (20)

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 

Lesson 4 - Data and Variables.pdf

  • 1. TUNASAN NATIONAL HIGH SCHOOL SDO - Muntinlupa City ROWELL L. MARQUINA Senior High School Teacher TUNASAN NATIONAL HIGH SCHOOL Lesson 4 - Java Programming
  • 2. LEARNING OBJECTIVES: At the end of the session, you will be able to: 1. define data and data type; 2. categorize data according to classifications; 3. discuss what is a variable and its importance; and 4. declare and initialize variables and use it in a Java program.
  • 3.
  • 4. Data in programming refers to information can be stored, processed, and generated by a computer system. WHAT IS DATA? IMAGE SOURCE: https://images.datacamp.com/image/upload/v1652357545/shutterstock_1770654182_d43667c1bc.jpg It is characterized by its capacity to: ▪ be transformed to other type of information ▪ to be transmitted to other computer systems.
  • 5. Examples of Data: ▪ Name ▪ Date of Birth ▪ Sex/Gender ▪ Address ▪ Cell Phone Number ▪ Serial Number ▪ Email Address ▪ String of Letters or Numbers ▪ A Yes/No Answer WHAT IS DATA? IMAGE SOURCE: https://images.datacamp.com/image/upload/v1652357545/shutterstock_1770654182_d43667c1bc.jpg
  • 6. When a data is inputted in computer system for processing, it will be entered in the system’s memory unit for either temporary or permanent storage. WHAT IS DATA? IMAGE SOURCE: https://learningc.org/_images/memory-pieces.png Depending on its size and data type, it will be assigned to occupy a specific space in the storage unit which are identified using memory address.
  • 7. Data type refers to the classification of data that tells the program what type of information it is getting and how it will be processed. WHAT IS DATA TYPE? IMAGE SOURCE: https://techvidvan.com/tutorials/wp-content/uploads/sites/2/2020/02/primitive-data- types-in-java.jpg
  • 8. There are 8 fundamental data types used in Java. WHAT IS DATA TYPE? byte refers to integers that ranges from -128 to 127 short refers to integers that ranges from -32,768 to 32,767 int refers to integers that ranges from -2,147,483,648 to 2,147,483,647 long refers to integers that ranges from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
  • 9. There are 8 fundamental data types used in Java. WHAT IS DATA TYPE? float refers to decimal numbers that has a precision of up to 7-digits after the decimal point. double refers to decimal numbers that has a precision of up to 15-digits after the decimal point. char refers to a data type that is used to store a single character. It can be a single letter, number, or symbol. boolean refers to the data type that can only store any of the two reserved values of either true or false.
  • 10.
  • 11. A variable is a name or label assigned by a programmer for a data container located in the memory unit. Using variable enables programmers to label a memory allocation with a more readable and recognizable name rather than its actual memory address for easier referencing. WHAT IS A VARIABLE? IMAGE SOURCE: https://www.startertutorials.com/corejava/wp-content/uploads/2014/09/Java-Variable.jpg
  • 12. ▪ The length of the variable name must be at least one character. ▪ It must not be a keyword used by Java such as print, println, system, include, int, float, and String to name a few. ▪ It should start with a either a letter, dollar sign ($), or underscore (_). ▪ It must not start with a number. NAMING CONVENTIONS: IMAGE SOURCE: https://www.startertutorials.com/corejava/wp-content/uploads/2014/09/Java-Variable.jpg
  • 13. ▪ Be mindful of your casing because Java is case-sensitive. ▪ Must not include a whitespace or blank instead the user can use an underscore. NAMING CONVENTIONS: IMAGE SOURCE: https://www.startertutorials.com/corejava/wp-content/uploads/2014/09/Java-Variable.jpg
  • 14. CHECKPOINT: Which of these variable names are acceptable? Why / Why not? ▪ num 1 ▪ BirthMonth ▪ 1stnum ▪ $num ▪ systemx ▪ 1st_Year ▪ employee_name ▪ product code
  • 15.
  • 16. VARIABLE DECLARATION A variable declaration is a Java statement that instructs the program to assign a name or label to a specific memory location in the computer. It also informs the program what type of data that the memory location shall contain.
  • 17. VARIABLE DECLARATION Data Type Variable Name Separator
  • 18. When declaring variables that are consists of different data types, each variable must be declared individually separated by a semicolon. VARIABLE DECLARATION
  • 19. When declaring variables that are consists of similar data types, all the variables can be declared altogether in one line but are separated by commas. VARIABLE DECLARATION
  • 20. Regardless of the similarity or differences of the data type, programmers can still opt to declare their variables in individually. It is done most likely for the purpose of readability. VARIABLE DECLARATION It is important to note that since variables are declared individually, each declaration must be separated by a semicolon.
  • 21. A variable initialization is a Java statement that declares a variable with an initial value. It allows the memory location to start with an initial data. VARIABLE INITIALIZATION
  • 22. VARIABLE INITIALIZATION Data Type Variable Name Assignment Operator Initial Value Separator
  • 23. Important notes when declaring or initializing a variable: ▪ Only the String data type is written with its first letter uppercased, the rest of the data types are written in lowercase. ▪ The String value is initiated by enclosing it value inside quotation marks (“). VARIABLE INITIALIZATION
  • 24. Important notes when declaring or initializing a variable: ▪ The integer and double values are declared “as is”. ▪ The character is declared by enclosing its value with a single quote (‘). VARIABLE INITIALIZATION
  • 25. CHECKPOINT: Which of these variable declarations / initializations are acceptable? Why / Why not? ▪ String sport = ‘basketball’; ▪ int weight = “52”; ▪ double math_grade = 95.39; ▪ String color = blue; ▪ Double gravity = 9.8; ▪ int speed = 8.56; ▪ String dog_breed = Shih Tzu
  • 26. DATA AND VARIABLES MR. ROWELL L. MARQUINA Tunasan National High School Senior High School Department Email Address: rowell.marquina001@deped.gov.ph sirrowellmarquina@gmail.com rmarquina@mitis.edu.ph