Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
48 Cards in this Set
- Front
- Back
How is a Java class defined?
|
public class Name{
} |
|
How is the main method written?
|
public static void main(String[] args){
} |
|
What is the extension for a java source code file?
|
.java
|
|
How do you execute a Java program?
|
Bytecode in .class
java Simple // executes program |
|
What statement is used for output?
|
System.out.println(" Your statement!"); or
System.out.print(" Your statement!"); |
|
What is the difference between print and println methods?
|
print will not use a carriage return on the statement.
|
|
What special character is used to end a Java statement?
|
;
|
|
What is considered to be the standard output device in java?
|
Console monitor
|
|
What is considered to be the standard input device in java?
|
keyboard
|
|
What are the escape sequence characters?
|
\n
\t \b |
|
List the 8 java primitive types:
|
byte
float short int long double boolean char |
|
How is a constant created in Java?
|
final double CALC_SALES_TAX = 0.07;
|
|
How is a string created in Java?
|
String income;
|
|
What are some useful methods from the String class?
|
charAt(int index), length(), toUpperCase(), toLowerCase()
|
|
What is the difference between a primitive variable and a reference variable?
|
primitives actually store a value.
int number; reference variable stores the address of where it was stored. |
|
What class is used for reading keyboard input?
|
Scanner
|
|
How do you create a Scanner object?
|
Scanner keyboard = new Scanner(System.in);
|
|
What import statement do you use to access the Scanner class?
|
import java.util.Scanner;
|
|
List the methods of the Scanner class?
|
nextInt
nextDouble nextLine nextFloat nextByte nextLong nextShort |
|
What is a class?
|
is a collection of programming staements that specify the instance fields and methods an object can have
|
|
What is the difference between a class and an instance class?
|
Instance of the class means the object
|
|
What is an accessor method?
What is a mutator method? |
Access retreives data (getter)
mutator stores data (setter) |
|
Is it a good idea to make fields private?
|
yes, so no other classes can access it.
|
|
What is the purpose of the "new" keyword?
|
it creates an object
|
|
What are the members of a class which will hold data when an object is created?
|
instance fields
|
|
Object-oriented programming (OOP) is centered on creating _______ rather than procedures.
|
objects
|
|
Data in an object are known as ______.
|
fields
|
|
Procedures in an object are know as ______.
|
methods
|
|
I object-oriented programming, we create the class and then from that class we create _______.
|
objects
|
|
A ______ can specify the fields and methods that a particular type of object may have.
|
class
|
|
A class is a "blueprint" that _______ may be created from.
|
objects
|
|
A class is not an object, but it can be a __________.
|
description of an object
|
|
An object created from a class is called an ______ of the class.
|
instance
|
|
An ________ is a Java keyword that indicates how a field or method can be accessed.
|
access specifier
|
|
When the _____ access specifier is applied to a class member, it can be accessed by code inside the or outside.
|
public
|
|
When the _____ access specifier is applied to a class member, the member cannot be accessed by code outside the class. The member can be accessed only by methods that are members of the same class.
|
private
|
|
_______ fields and instance methods require an object to be created in order to be used.
|
Instance
|
|
Instance methods are methods that are not declared with a special keyword, ____.
|
static
|
|
Classes can have special methods called ______.
|
constructors
|
|
Constructors are methods that are automatically called when an object is _______.
|
created
|
|
Constructors are used to perform operations at the time an object is ______.
|
created
|
|
Constructors have a few special properties that set them apart from normal methods:
|
have the same name as the class.
have no return type (not even void). may not return any values. are typically public. |
|
When an object is created, its constructor is ______ called.
|
always
|
|
If you do not write a constructor, Java provides one when the class is compiled. The constructor that Java provides is known as the _____.
|
default
|
|
default constructor which does the following:
|
sets all of the object’s numeric fields to 0.
sets all of the object’s boolean fields to false. sets all of the object’s reference variables to the special value null. |
|
The _______ constructor is a constructor with no parameters, used to initialize an object in a default configuration.
|
default
|
|
A parameter variable is, in effect, a _______.
|
local variable
|
|
Within a method, variable names must be _____.
|
unique
|