1/103
AP Comp-sci terms/concepts to know, core principals and basics to help understand it better, also commands to know and examples
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Debugging
Fixing a problem in your code
Syntax error
An error in the sequence of words or rules in a program that prevents the program from running
Algorithm
System.out.println();
Java method that lets us print out a line of the output to the use
System.out.print
Java method that lets us print output to the user, without ending the line printed.
String
A java type that represents a string of characters (text)
Syntax
Rules for writing code in a specific programming language
Variable
A symbol or container that holds a value
Primitive Type
Basic, simple data types that are inherent to Java (int, double, char, boolean)
Boolean
A true or false value
Reference Type
Reference variables store the address of the value
Data Type
A way to classify the information you can use in programming (numbers, words, true/false values)
Reassignment
Process of changing the value stored in a variable
Modulus operator
(written as % in most programming languages) divides two numbers and returns the remainder
Integer Division
When two integers are divided, the decimal values are truncated, or chopped off. (ex. 3 / 2 = 1 instead of 1.5, the decimal is decimated (literally lol))
Escape Sequence
Characters with special meanings
Arithmetic Expression
Combination of numbers, operators and sometimes variables that computes a value
Truncation
To trim some digits of a float or double-type number or some characters of a string from the right
Variable
A symbol or container that holds a value
Scanner class
A class within java.util, contains code specifically designed to help with user input
Assignment Statement
A line of code that assigns a value to a variable using the = operator
Input Buffer
A temporary memory area where input from the user is stored before being processed
Casting
Turning something of one type, into another type
Order of Operations
The order in which mathematical expressions should be evaluated, starts with parentheses, exponents, multiplications and division, addition and subtraction
Round-Off Error
The difference between the calculated approximation of a number and its exact mathematical value due to rounding
Integer Overflow
An error that occurs when the result of an integer operation does not fit within the allocated memory space
Truncate
To remove the digits of the right of the decimal point without rounding
Increment
Increase the value of a variable by one. variable++;
Decrement
Decrease the value of a variable by one. variable--;
Compound Assignment Operators
Allows programmers to shortcut variable assignments that include the variable being assigned a new value: x = x + y; shortcut: x += y;
Comment Out
Commenting out code makes the computer ignore it, so it does not run.
Precondition
Assumptions we make about what must be true before a method is called
Postcondition
What should be true after a method is called
Single Line Comment
// this is a single line comment
Multi-Line Comment
/* This is a multi-Line comment*/
Javadoc Comment
/** 1. One sentence description of code’s function. 2. Preconditions 3. Postconditions 4. Block tags */
Argument
A variable passed as a value to a function
Method
A method is a way to teach the computer a new command
Parameter
A variable that receives a value passed into a method from outside the method
Method signature
A method’s signature is the name of the method and the parameter list
Method overloading
Classes can have multiple methods with the same name, as long as the parameters to those methods are different
Return type
Indicates what type value is being returned from the method
Void
A return type that means the method does not return a value
Instance method
A method that defines the behavior of an object, defines an action the object can perform
Static methods
Methods that can be called w/o creating an object of class, called using dot operator along with class name, unless defined in the enclosing class
Encapsulation
Process of hiding the implementation details of a class from the user
Modularization
Organizing code into smaller, reusable pieces
Math Class
A part of the java.lang package, contains only static methods
Math.random
Can be manipulated to produce a random int or double in a defined range
Ex: Math.random()