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

Troubleshooting computer problem
Troubleshooting computer problemTroubleshooting computer problem
Troubleshooting computer problemsamsach1
 
Software update
Software updateSoftware update
Software updateeva
 
Java notes | All Basics |
Java notes | All Basics |Java notes | All Basics |
Java notes | All Basics |ShubhamAthawane
 
understanding the computer system
understanding the computer systemunderstanding the computer system
understanding the computer systemMarilou Jamero
 
Computer hardware troubleshooting
Computer hardware troubleshootingComputer hardware troubleshooting
Computer hardware troubleshootingJerome Luison
 
Parts of MSpowerpoint.pptx
Parts of MSpowerpoint.pptxParts of MSpowerpoint.pptx
Parts of MSpowerpoint.pptxRowena Marquez
 
canva presentation
canva presentationcanva presentation
canva presentationZainabAya
 
Control Statements in Java
Control Statements in JavaControl Statements in Java
Control Statements in JavaNiloy Saha
 
PL /SQL program UNIT 5 DMS 22319
PL /SQL program UNIT 5 DMS 22319PL /SQL program UNIT 5 DMS 22319
PL /SQL program UNIT 5 DMS 22319ARVIND SARDAR
 
Introduction to java
Introduction to java Introduction to java
Introduction to java Sandeep Rawat
 
Installing software
Installing softwareInstalling software
Installing softwareAjay Jassi
 
Hardware Problems
Hardware ProblemsHardware Problems
Hardware Problemsgustavo182
 
Basic Troubleshooting
Basic TroubleshootingBasic Troubleshooting
Basic TroubleshootingAaron Abraham
 

What's hot (20)

History of java'
History of java'History of java'
History of java'
 
Troubleshooting computer problem
Troubleshooting computer problemTroubleshooting computer problem
Troubleshooting computer problem
 
Software update
Software updateSoftware update
Software update
 
Java notes | All Basics |
Java notes | All Basics |Java notes | All Basics |
Java notes | All Basics |
 
understanding the computer system
understanding the computer systemunderstanding the computer system
understanding the computer system
 
Computer hardware troubleshooting
Computer hardware troubleshootingComputer hardware troubleshooting
Computer hardware troubleshooting
 
TABLE OF SPECIFICATION-COMPUTER HARDWARE SERVICING
TABLE OF SPECIFICATION-COMPUTER HARDWARE SERVICINGTABLE OF SPECIFICATION-COMPUTER HARDWARE SERVICING
TABLE OF SPECIFICATION-COMPUTER HARDWARE SERVICING
 
Using Computer Keyboard
Using Computer KeyboardUsing Computer Keyboard
Using Computer Keyboard
 
Java features
Java featuresJava features
Java features
 
Parts of MSpowerpoint.pptx
Parts of MSpowerpoint.pptxParts of MSpowerpoint.pptx
Parts of MSpowerpoint.pptx
 
Programming in Java
Programming in JavaProgramming in Java
Programming in Java
 
canva presentation
canva presentationcanva presentation
canva presentation
 
Control Statements in Java
Control Statements in JavaControl Statements in Java
Control Statements in Java
 
PL /SQL program UNIT 5 DMS 22319
PL /SQL program UNIT 5 DMS 22319PL /SQL program UNIT 5 DMS 22319
PL /SQL program UNIT 5 DMS 22319
 
Preprocessor in C
Preprocessor in CPreprocessor in C
Preprocessor in C
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Installing software
Installing softwareInstalling software
Installing software
 
Hardware Problems
Hardware ProblemsHardware Problems
Hardware Problems
 
Basic Troubleshooting
Basic TroubleshootingBasic Troubleshooting
Basic Troubleshooting
 

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
 
Lesson 1 - Introduction to Programming .pdf
Lesson 1 - Introduction to Programming .pdfLesson 1 - Introduction to Programming .pdf
Lesson 1 - Introduction to Programming .pdfROWELL MARQUINA
 
Java Programming - Conditional Statements (Switch).pdf
Java Programming - Conditional Statements (Switch).pdfJava Programming - Conditional Statements (Switch).pdf
Java Programming - Conditional Statements (Switch).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
 

More from ROWELL MARQUINA (20)

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
 
Lesson 1 - Introduction to Programming .pdf
Lesson 1 - Introduction to Programming .pdfLesson 1 - Introduction to Programming .pdf
Lesson 1 - Introduction to Programming .pdf
 
Java Programming - Conditional Statements (Switch).pdf
Java Programming - Conditional Statements (Switch).pdfJava Programming - Conditional Statements (Switch).pdf
Java Programming - Conditional Statements (Switch).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
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 

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