0% found this document useful (0 votes)
2 views

Computer 10 Lesson 3 4

Uploaded by

pjehanakeela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Computer 10 Lesson 3 4

Uploaded by

pjehanakeela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Lesson 3

Java™ Names and Labels


• Java Keywords
• Identifiers
• Data Types
• Variables
• Constants
• Casting
Java Keywords
Keywords in Java are reserved for specific uses.
Identifiers
Identifiers are user-defined names for methods,
variables, constants, and classes.
• It start with a letter, an underscore ( _ ), or a dollar
sign ( $ ) followed by alphanumeric characters,
and underscores.
• Create identifiers that are descriptive of their
purpose.
• Your identifier must contain no spaces.
EXAMPLE
Data Types
Java has two sets of data types: primitive and
reference(non-primitive).
Below is a table of data types:
Data Types
• byte, short, int, and long hold integer values.

• float and double are floating point literals –


numbers with possible decimal parts. float is 32
bits in length and double is 64 bits long.
Variables
Variables are identifiers whose values can be
changed.

Syntax

Examples
Constants
Constants are identifiers whose values never
change once declared.

Syntax

Examples
Casting
Casting is the process of assigning a value or
variable of a specific type to a variable of
another type,
Lesson 4
Connecting Data Through
Operators
• Operators
• Operator Precedence
Operators
Operators are symbols that perform logical or
mathematical functions on operands such as
variables, constants, and objects.
• Unary operators require only one operand.
 negation (-)
 bitwise complement (~)
 increment (++)
 decrement (--)

• Binary operators require two operands.


Arithmetic Operators

You might also like