0% found this document useful (0 votes)
2 views2 pages

NJCTL Java Study Guide

The NJCTL Java Complete Study Guide covers essential concepts in Java programming, including variables and data types such as primitive types and strings, as well as constants and variable rules. It also explains operators, including arithmetic, comparison, logical, and assignment operators, with examples. Additionally, the guide discusses conditional statements, including if-else structures and switch statements, providing tips for testing all cases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

NJCTL Java Study Guide

The NJCTL Java Complete Study Guide covers essential concepts in Java programming, including variables and data types such as primitive types and strings, as well as constants and variable rules. It also explains operators, including arithmetic, comparison, logical, and assignment operators, with examples. Additionally, the guide discusses conditional statements, including if-else structures and switch statements, providing tips for testing all cases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NJCTL Java Complete Study Guide

Section 1: Variables and Data Types


Primitive types: int, double, boolean, char
- int: whole numbers
- double: decimals
- boolean: true/false
- char: single character, use single quotes

Strings: sequence of characters, use double quotes


- Important methods: .length(), .charAt(index), .substring(start, end), .equals(string), .toLowerCase(),
.toUpperCase(), .indexOf(char/string)

Constants: use final keyword


Example:
final int MAX = 100;

Variable rules: letters, numbers, _, no spaces, cannot start with a number


Example:
int age = 16;
double gpa = 3.7;
boolean isStudent = true;
char grade = 'A';
String name = "AP CSA";

Section 2: Operators
Arithmetic operators: +, -, *, /, %
Increment/Decrement: ++, --
Comparison operators: ==, !=, <, >, <=, >=
Logical operators: &&, ||, !
Assignment operators: =, +=, -=, etc.

Example:
int x = 5;
x += 3; // x = 8
boolean test = (x > 5) && (x < 10); // true
Section 3: Conditional Statements
if, if-else, if-else if-else
Nested conditionals
Switch statements (switch-case)
Boolean expressions and logic
FRQ tips: always test all cases

Example:
int score = 85;
if (score >= 90) {
[Link]("A");
} else if (score >= 80) {
[Link]("B");
} else {
[Link]("C");
}

You might also like