Sunteți pe pagina 1din 33

Class and

Object
Prepared by: Neil Bryan Dencilla
CLASS
- A class is a blueprint from
which individual objects are
created.
- it is a blueprint or a set of
instruction to build a specific
type of object.
OBJECT
- The state of an object is stored
in fields (variables), while
methods (functions) display the
object's behavior. Objects are
created from templates known as
classes.
LET’S GET
STARTED !!
Fundamental Data Types
-Programming language have
varieties of data types.

-The variety of data types available


allow the programmer to select the
appropriate to the needs of the
application as well as the machine.
Fundamental Data Types

Java’s Primitive Types :


• Int ( double, float )
• Char ( String )
• Boolean – True or False
Fundamental Data Types

INT – used to store whole


numbers
Examples :
2313
1412
543
23
420
Fundamental Data Types

DOUBLE – used to store


decimal numbers
Examples :
23.431
123.323
1.22
32.323
Fundamental Data Types
STRING – used to store words,
phrases and sentences.
Examples :
“SPC“
“Where do broken hearts go?”
“ I LOVE YOU TELEBERT TELEBERT! “
Fundamental Data Types
Char – Java types that is
used to store characters.
Examples :
‘S‘
‘P‘
‘C
Fundamental Data Types

BOOLEAN – True or False


Boolean automatically answers True
or False depending on the given
variables and conditions.
Variables
Let’s start
making Variables
!!
VARIABLES
- A variable name can be chosen by
the programmer in a meaningful way
so as to reflect its function or nature
in the program.
VARIABLES
WeightKg = 94
HeightCm = 163
Total = 100
SpeedKm = 60.49
Pi_value = 3.141592653589793
FirstName = Neil
LastName = Dencilla
R_Status = True
Rules for defining variables
- Variable names may consist of letters,
digits, and the underscore character ( _ ),
subject to the rules given below:

• The variables must always begin


with a letter. Some systems permit
underscore as the first character.
Rules for defining variables
• Uppercase and lowercase are
significant. That is, the variable Rate
is not the same as rate or TOTAL.
• The variable name should not be a
keyword.
• White space is not allowed.
NOTE :
char, int, float and double,
etc are all keywords and
therefore their use is
reserved. They may not be
used as names of
variables.
Let’s make
program using
Java Data Types !!

S-ar putea să vă placă și