Handout 2

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Java Keywords, Identifiers, Data Types, and Casting

Variables
 Symbol used in a program that stands for a value or data stored in a computer’s memory
 Identifiers whose values can be changed
o Local Variables – variables can only be used in the methods which there are declared
o Global Variables – variables used by any methods within the class or program
Constant
 Fixed value used in certain mathematical or programming contexts
Operand
 Constant, variable, or expression which an operator will act upon
Expression
 Statement that is composed of at least one operator and one operand; it evaluates to a particular value on the result
of the operation
Operator
 Action that is applies on the operand/s, resulting in some value; symbol that represents actions or computations to
be performed
o Assignment Operator (=)
 This operator only assigns value to an operand
o Mathematical Operator (+, -, /, *, %)
 It symbolizes in arithmetic
o Increment (++) and Decrement (--)
 These operators only increment or decrement a value of an operand
o Relational Operator (==, !=, >, <, >=, <=)
 These operators perform a comparison test between variables and constant
o Logical Operator (&&, ||, !)
 These operators further expand the relational operator since they add more control to it
Operator Precedence Rule
 Hierarchy that determined the sequence at which the operator in a given compound expression (two or more
operators) are to be performed
Comments
 Are lines of codes that are not executed during the program
 They are used to label a specific line of code
o Single Line Comment uses double slash(//)
 It comments only one line
o Multi Line Comment uses slash-asterisk and asterisk-slash
 It comments several lines

Statements
 Is an instructional code that commands the computer to do a certain action upon its execution and it must be
terminated by a semicolon (;)

Data Types
 Integer (int)
o Variable that holds positive or negative whole numbers
 Character (char)
o Variable that holds a single character (one byte), which may be a number, a letter, or a symbol
 Boolean (bool)
o Is a logical data type with only two values which is “True” or “False”
 Float (float)
o Numbers with decimal parts
 String
o A data type that supports all kind of text
Keyword
 Reserved words in a programming language that have specific uses
 These are the keywords used in Java:

abstract boolean break byte


case catch char class
const continue default do
double else extends final
finally float for goto
if implements import instanceof
int interface long naïve
new package private protected
public return short static
strictfp super switch synchronized
this throw throws transient
try void volatile while
Casting
 Is the process of assigning a value or a variable of a specific type to a variable of another type
Concatenation
 Is the process of joining values together
Literals
 Values assigned to variables or constants
Unicode
 Universal code that has unique numbers to represent each character

You might also like