click below
click below
Normal Size Small Size show me how
JAVA
| What is a constant? | A value that cannot be changed after initialization. |
| What is an argument? | A value passed to a method when the method is called. |
| What is an assignment operator? | The = symbol used to assign a value to a variable. |
| What is an assignment statement? | A statement that stores a value in a variable. Example: x = 5; |
| What is a class used as a data type? | A reference type used to create objects. Examples: String and Scanner. |
| What is a class header? | A declaration that identifies a class. Example: public class Student |
| What is an access modifier? | A keyword that controls accessibility. Examples: public and private. |
| What is a comment? | Text ignored by the compiler. Example: // This is a comment |
| What does compile mean? | To translate Java source code into bytecode. |
| What is concatenation? | Joining Strings using the + operator. |
| What is a data type? | A classification that determines what type of value a variable can store. |
| What is a declaration statement? | A statement that declares a variable and its data type. Example: int age; |
| What is an input statement? | A statement that reads information entered by the user. |
| What is a mathematical operator? | An operator used for arithmetic such as addition and multiplication. |
| What is a method call? | A statement or expression that invokes a method. Example: name.length() |
| What is a method header? | The first line of a method definition containing the method name and other information. |
| What is a logic error? | An error that causes incorrect results even though the program runs. |
| What is an object? | An instance of a class. |
| What is object instantiation? | Creating an object using a constructor and usually the new keyword. |
| What is an output statement? | A statement that displays information to the user. |
| What is a parameter? | A variable in a method header that receives an argument. |
| What is a primitive data type? | A built-in data type such as int or double or char or boolean. |
| What is a reference variable? | A variable that stores a reference to an object. |
| What is a return type? | The type of value a method returns. |
| What is the main method? | The traditional starting point for a standalone Java application. |
| What is a String literal? | Text enclosed in double quotation marks. Example: "Hello" |
| What is a syntax error? | An error caused by violating Java language rules. |
| What is a primitive variable? | A variable that stores a primitive value directly. |
| What is bytecode? | Instructions produced by the Java compiler and executed by the JVM. |
| What is a runtime error? | An error that occurs while a program is running. |
| What is a conditional statement? | A statement that executes code based on a condition. |
| What is a relational operator? | An operator used to compare values such as > or < or ==. |
| What is a logical operator? | An operator used with boolean expressions such as && or |
| What is a condition? | An expression that evaluates to true or false. |
| What happens if a traditional Java application has no main method? | It cannot start through the traditional main method entry point. |
| How should Java variables be capitalized? | Start with lowercase and capitalize each additional word. Example: studentAge |
| How should Java methods be capitalized? | Start with lowercase and capitalize each additional word. Example: getName() |
| How should Java classes be capitalized? | Capitalize the first letter of each word. Example: StudentInformation |
| What is the syntax for declaring a variable? | dataType variableName; |
| Give an example of declaring a primitive variable. | int age; |
| Give an example of declaring a reference variable. | String name; |
| What three things happen when declaring a variable? | The name and data type are established and storage is allocated for the value or reference. |
| What is the difference between primitive and reference variable memory? | A primitive variable stores its value directly while a reference variable stores a reference to an object. |
| What does the + operator do with Strings? | It joins Strings together through concatenation. |
| What does it mean to instantiate an object? | To create an object from a class. |
| What syntax is used to instantiate an object? | ClassName variable = new ClassName(arguments); |
| What is the result of 7 / 2 using integers? | 3 because integer division discards the fractional part. |
| What is the result of 7.0 / 2? | 3.5 because floating-point division keeps the decimal. |
| What does the % operator do? | Returns the remainder after division. |
| What is the result of 10 % 3? | 1 |
| Can the % operator be used with doubles in Java? | Yes. It works with integer and floating-point operands. |
| What are the four main parts of a method header? | Access modifier and return type and method name and parameter list. |
| What is the difference between an argument and a parameter? | An argument is the actual value passed while a parameter is the receiving variable. |
| What does void mean in a method header? | The method does not return a value. |
| What should you do with a returned method value? | Store it or display it or use it in another expression when needed. |
| What is the difference between a method header and a method call? | A method header declares the method while a method call invokes it. |
| What is the difference between an argument and a return value? | An argument goes into a method while a return value comes out. |
| What Java class is used to read keyboard input? | Scanner |
| What import statement is needed for Scanner? | import java.util.Scanner; |
| How do you create a Scanner object? | Scanner scnr = new Scanner(System.in); |
| What does nextInt() do? | Reads an integer from user input. |
| What does nextDouble() do? | Reads a decimal number from user input. |
| What does next() do? | Reads the next token from user input. |
| What does nextLine() do? | Reads an entire line of input including spaces. |
| What does nextBoolean() do? | Reads a boolean value from input. |
| What does length() do? | Returns the number of characters in a String including spaces. |
| What does charAt(index) do? | Returns the character at the specified index. |
| What does indexOf(str) do? | Returns the index of the first occurrence of the specified text. |
| What does indexOf(str, fromIndex) do? | Returns the index of the first occurrence starting at the specified position. |
| What does indexOf return if text is not found? | -1 |
| What does substring(begin) do? | Returns the String from the starting index to the end. |
| What does substring(begin, end) do? | Returns characters from the starting index up to but not including the ending index. |
| What does lastIndexOf(str) do? | Returns the index of the last occurrence of the specified text. |
| What does equals(str) do? | Returns true if two Strings contain the same characters. |
| What does contains(str) do? | Returns true if the String contains the specified text. |
| What does startsWith(str) do? | Returns true if the String begins with the specified text. |
| What does endsWith(str) do? | Returns true if the String ends with the specified text. |
| What does "Hello".length() return? | 5 |
| What does "Hello".charAt(1) return? | e |
| What does "banana".indexOf("a") return? | 1 |
| What does "banana".indexOf("a", 2) return? | 3 |
| What does "Computer".substring(2, 5) return? | mpu |
| What does "Hello".substring(2) return? | llo |
| What does "banana".lastIndexOf("a") return? | 5 |
| What does "Computer".contains("put") return? | true |
| What does "Hello".startsWith("He") return? | true |
| What does "Hello".endsWith("lo") return? | true |
| What does "Hello".equals("hello") return? | false because equals is case sensitive. |
| What index does the first character in a String have? | 0 |
| Does substring(begin, end) include the ending index? | No. The ending index is excluded. |
| what is a argument | An argument is the actual value passed into a method when it's called. |
| what is a parameter | A parameter is the variable in the method header that receives the argument. |