Save
4Q CSS
Save
Share
Learn
Content
Leaderboard
Learn
Created by
KATHRINA
Visit profile
Cards (29)
Expression operands
Values involved in an operation
Relational operators
Used to check the relations between two operands
Relational
operators
Also called
comparison
operators
Result is always a Boolean value
A
value
involved in an operation is called an
operand
If statement
If the
condition
is true, execute the code block, else execute the else block
If-else
statement
If
condition
is true, execute if block, else execute else block
If-elseif-else statement
If condition1 is true, execute if block, else if condition2 is true, execute elseif block, else execute else
block
Logical operators
Used in conditional statements
Nested
if
A conditional statement within another conditional statement
Methods
Reusable blocks of code that perform a specific task
Array
Used to store multiple values of the same data type in a single variable
Arrays
Provide a way to store
multiple
values of the same type in a contiguous memory block
Array indexing starts at 0
Accessing array
Using the index number to access a specific element
Loops
Execute a block of code as long as a specified condition is reached
While loop
Loops through a block of code as long as a specified condition is true
Changing array element
Refer to the
index number
to change the value of a specific
element
Iterating
arrays
Reading every element inside an array and doing something with it
Array length
The
size
of an array, found by calling the
length
property
Array indexing starts at?
0
String
a reference data type that can store one or more characters reference data types have access to useful methods
.equals
(
"
"
)
;
// compare Two string if the string start from Upper Case // the comparing string must be Upper Case
.
equalsIgnoreCase
(" ") // ignoring Case Sensitivity
.length()
; // returns the length of a specified string
.charAt(whole number);
// returns the character at the specified // Index in a string
.indexOf
("
"
); // returns the position of the first occurrence of // specified characters in a string
.isEmpty
(); // checks whether a string is empty or not
.toUpperCase()
; // converts a string to upper case
.toLowerCase()
; // returns the string in lower case
.replace
(
oldChar
,
newChar
);
// replace all occurrences of a String
// in another String or all occurrences
// of a char with another char