AP CSA EXAM Terms

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Concatenation

Joining two strings together. String concatenation operator produces a new string by appending the second operand onto the end of the first operand.

Random Method

Math.random() method returns a pseudorandom double type number greater than or equal to 0.0 and less than 1.0.

Important String Operations

.equals(), .length(), .substring(begIndex, endIndex) .indexOf(char ' '), .CharAt(int a)

Constructor

A block of code that initializes the newly created object. A constructor resembles an instance method in java but it's not a method as it doesn't have a return type. Constructor also has same name as the class.

Out of bounds error

A run-time error that occurs when you request for a negative or an index greater than or equal to size of array is made, then the JAVA throws a ArrayIndexOutOfBounds Exception

Object

A self-contained component which consists of methods and properties to make certain type of data useful. (EX: BankAccount account1 = new BankAccount();)

Boolean

A single value of either TRUE or FALSE

Sentinel

A special input value that tests the condition within the while loop. The terminal condition in while (-----){

Iteration

A technique used to sequence through a block of code repeatedly until a specific condition either exists or no longer exists

Entry controlled

A type of loop in which the condition is checked first and then after the loop body executed. (The condition is tested before the execution of the loop) (EX: while and for loops)

Parameter

A value that you can pass to a method in Java. Then the method can use the parameter as though it were a local variable initialized with the value of the variable passed to it by the calling method. (EX: getNum(*parameter*))

Variables

A variable is a container which holds the value while the java program is executed. A variable is assigned with a datatype. Variable is a name of memory location. (local, instance and static)

JAVA CONCEPTS TEXTBOOK CHAPTER 7 SUMMARY

A while statement executed a block of code repeatedly. A condition controls how often the loop is executed. An off-by-one error is a common error when programming loops. You can use a for loop when a variable runs from a starting to an ending value with a constant increment or decrement Loops can be nested. A typical example of nested loops is printing a table with rows and columns. Sometimes the termination condition of a loop can only be evaluated in the middle of a loop. You can introduce a Boolean variable to control such loop. In a simulation, you repeatedly generate random numbers and use them to simulate an activity

Infinite loop

An instruction sequence that loops endlessly when a terminating condition isn't met.

String

An object that represents sequence of char, backed internally by a char array. Since arrays are immutable (cannot grow), Strings are immutable as well. Whenever a change to a String is made, an entirely new String is created.

Exception (Run Time Error)

An unwanted or unexpected event, which occurs during the execution of a program i.e at run time, that disrupts the normal flow of the program's instructions. (AKA Runtime error) (Example for exceptions are, arithmetic exception, Divide by zero exception, etc. Exceptions in Java are something that is out of developers control.)

Increment

Increment operators are used to increase the value of the variable by one (++)

Initialize

Initializing a variable means specifying an initial value to assign to it. (EX: int num = 0;)

Variable declaration statement

Declaring a variable's type in the program. Variable name on right and type on the left (EX: double celsius; or int age;)

Decrement

Decrement operators are used to decrease the value of the variable by one (--)

Scientific notation for computers

EX: 1.314E1 or 1.314E1 (1.314 * 10^1) EX: 1.314E-1 (1.314 * 10^-1

Return Type

Every method in Java is declared with a return type and it is mandatory for all java methods. A return type may be a primitive type like int, float, double, a reference type or void type(returns nothing)

If

Executes a certain section of code if the test expression is evaluated to true

Implicit vs. explicit reference

Explicit means done by the programmer. Implicit means done by the Java Virtual Machine or the tool, not the Programmer.

JAVA CONCEPTS TEXTBOOK CHAPTER 6 SUMMARY

The if statement let's a program carry out different actions depending on a condition A block statement groups several statements together Relational operators compare values. The == operator tests for equality. == does not work for strings. Use .equals method The compareTo method compares strings in dictionary order The == operator tests whether two objects references are identical. To compare the contents of the objects, the equals method must be used The null reference refers to no objects Multiple conditions can be combined to evaluate complex decisions. The correct arrangement depends on the logic of the problem to be solved. The Boolean type has two values (true and false) A predicate method returns a Boolean value && (and) || (or) ! (not) De Morgan's law shows how to simplify expressions in which the not operator is applied to terms joined by the && or || operators You can store the outcome of a condition in a Boolean variable

Comment

The java comments are statements that are not executed by the compiler and interpreter. The comments can be used to provide information or explanation about the variable, method, class or any statement.

Abs

The method gives the absolute value of the argument. The argument can be int, float, long, double, short, byte.

Primitive Data Type

The most basic data types available within the Java language. There are 8: boolean, byte, char, short, int, long, float, and double

Compile time error

These errors are errors which prevents the code from compiling because of error in the syntax such as missing a semicolon at the end of a statement or due to missing braces, class not found, etc. These errors will be detected by java compiler and displays the error onto the screen while compiling.

JAVA CONCEPTS TEXTBOOK CHAPTER 5 SUMMARY

To show a frame, construct a JFrame object, set it size, and make it visible In order to display a drawing in a frame, define a class that extends the JComponent class Place drawing instructions inside the paintComponent method. This method is called whenever the component needs to be repainted. The Graohics class lets you manipulate the graphics state (such as the current color) The Graphics2D class has methods to draw shape objects Applets are programs that run inside a web browser To run an applet, you need an HTML file with the applet tag You view applets with the applet viewer or a Java-enables browser The drawString method draws a string, starting at its base point A graphical application can obtain input by displaying a JOptionPane

Exit Controlled Loop

Used when checking of test condition is mandatory after executing the loop body. (EX: do while loops)

Off by one error

Usually seen with loops, this error occurs when we have "<=" instead of "<" when we are checking the expression in the loop. EX: Doing for (int i = 0; i <= n; ++i) { ... } instead of for (int i = 0; i < n; ++i) { ... }

User-defined Symbols

Variable and program names are examples. Cannot be reserved words, cannot start with a number, and cannot have symbols such as ?, !, $

Break

When the break statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop.

Reserved Words (Keywords)

Words in Java that have special meaning and therefore cannot be used as identifiers. Will give an error "Expected"

Reserved Words Examples

abstract boolean break class default double else float int void while

Char

char represents a single character whereas. We define char in java program using single quote (')

Double

A primitive data type that represents numbers with a decimal point. It can represent larger numbers and has more precision than float, but it takes up more memory.

Blue Pelican Java (BPJ) UNKNOWN STUFF FROM LESSON 1-12, 14, 32, 35

.substring(int index) starts at that index and goes till the end of the string substring(int begIndex, int endIndex) starts at that begIndex and ends right before endIndex *Escape Sequence* \""\ (to put quotes in a string) \n (new line) Only cast when information would be lost Use the keyword final to indicate a constant (ALL CAPS) *Switch* statement is useful when we have an integer variable that can be one of several quantities EX:( switch (choice) { case 1: (code) case 2: (code) default: (enter 1 or 2!) ) default command is optional breaks jumps us out of the switch structure and continues with code execution KNOWN BINARY, HEX, OCTAL If a value is given in hex (0x leads the number) or in octal (0 leads the number) java will automatically translate to decimal if printed *BOOLEAN ALGEBRA* EX: a&&(b||c) becomes (a&&b)||(a&&c) (Have to distribute) *DEMORGAN'S THM* (a,b,c are booleans) !(a+b) = (!a)*(!b) !(a*b) = (!a)+(!b) *Obvious Thm* a + false = a a + true = true a + a = a a * a = a a * true = a ! !a = a a * !a = false a * false = false a + !a = true *THINK OF TRUE AND FALSE AS 1 AND 0, AND THE THMS ABOVE MAKE MORE SENSE THINK OF + AS || AND * AS && *2D ARRAYS/MATRIX* Two ways: int a [][] = new int[3][2] int a [][] = { {1,1}, {2,2,}, {3,3}} a.length returns the number of rows a[0].length returns the number of columns in row 0 ARRAYS are automatically initialized to 0s

Float

A primitive data type that represents numbers with a decimal point. It cannot hold numbers as large or as precise as a double, but it takes up less memory.

JAVA CONCEPTS TEXTBOOK CHAPTER 1 SUMMARY

A computer must be programed to perform tasks. Different tasks require different programs. A computer program executes a sequence of very basic operations in rapid succession. A computer program contains the instruction sequences for all tasks that it can execute At the heart of the computer lies the central processing unit (CPU) Data and programs are stored in primary storage (memory) and secondary storage such as hard disks. The CPU read machine instructions from memory. The instructions direct it to communicate with memory, secondary storage, and peripheral devices Generally, machine code depends on the CPU type. However, the instruction set of the Java virtual machine (JVM) can be executed on many CPUs Because machine instructions are in coded as numbers it is difficult to write the program in machine code High-level languages allow you to describe tasks at a higher conceptual level than machine code A compiler translates programs written in a high-level language into machine code Java was originally designed for programming consumer devices, but it was first successfully used to write Internet applets Java was designed to be safe and portable, benefiting both Internet users and students Java has a very large library. Java is case sensitive Classes are the fundamental building block of Java programs Every Java application contains a class with the main method. When the application starts, the instruction in the main method are executed. Each class contains definitions of methods. Each method contains a sequence of instructions Use comments to help human readers understand your program A method is called by specifying an object, the method name, and the method parameters. A syntax error is a violation of the rules of the programming language. The compiler detects syntax errors A logic error code is a program to take

While-Loop

A control flow statement that allows code to be executed repeatedly.

Overloading

A feature that allows a class to have more than one method/constructor having the same name, if their argument lists are different.

Overriding

A feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its super-classes or parent classes. (Using super.)

Encapsulate

A mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. (EX: What we did w/the BankAccount and Employee; having private variables)

Signatures

A method signature is part of the method declaration. It's the combination of the method name and the parameter list. (EX. public int *getNum(int a)*)

For-Loop

A particular kind of looping construct. (EX: for (int i = 0; i<7; i++){)

Keyword

Predefined, reserved words used in Java programming that have special meanings to the compiler

Integer

Primitive data type representing whole numbers only

THINK JAVA Chapter 1, 2, 3, 4, 5, 6, 7, 12

REFER TO https://quizlet.com/_712jms?x=1jqt&i=151dk5 ARRAYS int[] variable; double[] values; variable = new int[4]; values = new double[size]; [] operator to store values EX: variable[0]=5; ARRAY LENGTH a.length Histogram: An array of integers where each integer counts the number of values that fall into a certain range.


संबंधित स्टडी सेट्स

Chapter 29: Growth and Development of the Adolescent - ML6

View Set

Chapter 19 section 1 - Europeans Explore the East

View Set

Project Management Exam 1 practice

View Set

SPM Speaking - Pros and Cons of Working Part Time as a Student

View Set

NUR415 Remediation Qs (Session 1- Bleeding & Cardiovascular)

View Set

Macroeconomics 1040 Final Exam pt.2

View Set

Hematology & Immunology Peds NCLEX ?'s

View Set

Musculoskeletal Trauma and Orthopedic Surgery

View Set