1/38
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
operating systems
mange the computers resources; they are typically run as a computer is turned on. some examples include security-related software, and process management tools
applications
programs that users interact directly with. these are typically explicitly run by the users this can include word processors, games, music software, or java programs
compilers
programs that translate high-level programming languages into assembler or machine code, allowing the computer to execute the code. one way of executing programs
interpreters
programs that take course code as input and execute high-level programming code directly. it is another way of executing a program but is much slower than a compiler
debuggers
based on interpreters since they support step-by-step execution of source code
variable
a piece of memory that can store a specified type of value
data types
different types of variables
String
a data type, stores text and surrounded by double quotes. non-primitive type
int
stores integers (whole numbers). it takes 32-bits of memory and is a primitive type
float
stores floating point numbers with decimals. it takes 64-bits of memory and is a primitive type
char
styoes single characters and surrounded by single quotes. it takes 8-bits of memory and is a primitive type
boolean
stores values with two states, either true or false. it is a primitive type
declaration
process of defining a variable and its type in a program
initializing
the process of assigning a value to a variable at the time of declaration
reserved
keywords in programming that have special meanings and cannot be used as identifiers for variables or functions
modulus
an operator used to find the remainder of a division operation, denoted by the percent symbol (%) in java
concatenate
to join two or more strings together into a single string
comments
text used in code to provide explanations or annotations for better readability, ignored by the compiler
in-line comments
one line comments, start with the // and terminate as soon as the next line starts
multi-line comments
can last for multiple lines, start with /* and end with */
compile-time errors
errors that are caught by the compiler. includes syntax errors that violate the rules of a language and type errors which come from the mususe of variables
run-time errors
errors that appear during the programs execution. these include semantic errors that obey the rules of the language but do not express the meaning you intended. these can also include division-by-zero errors or wrong outputs
immutable
something you cannot change the contents of
immutability of strings
strings are immutable. when you concatenate two strings you are not adding text to the end of the string. rather, a new string is created which combines the old string and new string (bad time complexity)
string comparison + methods
cannot be using ==, <=, <, >=, > or ≠
can use .equals to see if the contents are equal
can use .compareTo() to compare lexicographically
can use .length() to return the number of characters of the string
=== checks if the reference points of the two strings are the same
Scanners
built-in classes provided in the util package that allow us to easily obtain the input of various data types
scanners deal with whitespace on default and cannot deal with input errors (ex. user enters string instead of int) - use try/catch
Importing, declaring, and closing a Scanner
import java.util.Scanner goes at the top of our program
declared with the line Scanner input = new Scanner (System.in);
scan.close() closes the scanner so user cannot provide any more input
Scanner operations
operations include .nextInt(), .nextLine(), .nextDouble() and more
conditional statements
only executes with a certain condition is true
if-statements and switch cases
if-statements
conditional statement
switch statement
conditional statement
logical operators
used to form more complex condition
&&
and
||
or
!
not
==
equals, for booleans, ints, chars, etc.
if used for strings it checks for reference equality
>, >=
greater than, greater than or equal to
<, <=
less than, less than or equal to