AP Computer Science Chapter 3
About this set
Created by:
monkey1617 on September 7, 2011
Subjects:
Log in to favorite or report as inappropriate.
Order by
41 terms
Terms | Definitions |
|---|---|
Primitive data types | A category of data types which includes numbers (integer and floating point), characters, and Booleans (true/false); combined in expressions involving operators |
Objects | Another category of data type which includes scanners and strings; messages are sent to them; must be instantiated before use |
double | holds decimal numbers, 8 bytes, double the size of ints |
int | holds whole numbers, 4 bytes, 1/2 the size of a double |
Literals | items in a program whose values do not change; restricted to the primitive data types and strings |
variable | an item whose value can change during the execution of the program but its type cannot |
variable declaration statement | declaring a variable's type in the program; ex/ double celsius; or int age; or int x, y, z = 7; ; variable name on right and type on the left |
final <data type> <name> = #; | How do you declare constants? |
<variable> = <expression>; | What is the form of an assignment statement where the value of the expression on the right is assigned to the variable on the left? |
Syntax | the rules for combining words into sentences, or statements; e.g. the arithmetic operators * and / cannot be adjacent and left and right parentheses must occur in matching pairs |
Semantics | the rules for interpreting the meaning of statements |
Size, literalness, and rigidity | What are the three differences between programming and natural languages? |
Numbers | What are numeric data types? |
Ints and Doubles | What are 2 EXAMPLES of numeric data types? |
Arithmetic expression | consists of operands and operators combined in a manner familiar from algebra; binary operators must be placed between their operands whereas unary operators are pllaced before their operands |
2.5 | What does 5.0/2.0 yield? |
2 | What does 5/2 yield? |
Modulus (%) | This operators yields the remainder obtained when one number is divided by another. E.g. 9_ 3 yields 4; 9.3 _ 5.1 yields 4.2; Hint, the answer is the term plus the symbol (the underscore in the examples) in parentheses |
arithmetic overflow | when you are out of range of a numeric data type; if you add one to the max value, it goes back to the min value |
Mixed mode arithmetic | The less inclusive data type (int) is temporarily and automatically converted to the more inclusive type (double) before the operation is performede.g. double d; d = 5.0/2; -> yields 2. |
i = d | If d is a double and i is an int, you can say that i = 45, d = 1, but not _ = __ because the first element is less inclusive than the second element |
casting | allows one data type to be explicitly converted to another by saying what data type you want to convert it to in parentheses |
+ | What is the concatenation operator? |
\ | What is the escape character? |
escape sequences | special sequences involving the backslash character |
\\ | What do you do if a string must contain a backslash? |
the length method | a string returns its _ in response to a _ message; includes all letters, spaces, and punctuation |
methods | implemented by classes; inside the class; instructions; may or may not return a value; println doesn't return a value but nextDouble does; a code that executes when the object receives a message |
messages | tell the object to use a certain method; sent to an object |
Method signature | the method's name and the types and number of its parameters |
The method doesn't return a value | What does void indicate? |
A...Z, a...z, _, $, 0-9 | What are acceptable user-defined symbols (what variables and program names consist of)? |
reserved words | words that cannot be employed as user defined symbols due to the fact that they have special meaning in Java; case-sensitive - you can use Import and IMPORT but not import |
package | makes it easy for programmers to share code; code written by many other programmers; e.g. java.util |
import x.y.z; | what is the general form of an import statement |
import x.y.*; | What is the statement to import all the classes with a subsection? |
Comments | explanatory sentences inserted in a program in such a manner that the compiler ignores them; you can state them as // for end of line _ and text between / and / for multiline _; appear in green on Java |
Syntax errors | occur when we violate a syntax rule, no matter how minor; detected at compile time; e.g. - a semicolon is missing at the end of a statement or variable; Java prints an error message and lets you know where the error is, however, they are cryptic |
Run time errors | occur when we ask the computer to do something that it considers illegal; e.g. dividing by zero; Java prints a message saying where the error is but it is cryptic |
Logic Errors | occur when we fail to express ourselves accurately; the instruction is phrased properly so the syntax is correct, the instruction is meaningful so the semantics are valid, but the instruction does not do what we intended; Java does not detect these errors automatically |
System.out.println ("<some message." + <variable name>); | What is the debugging code? |
First Time Here?
Welcome to Quizlet, a fun, free place to study. Try these flashcards, find others to study, or make your own.