Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key

image

Play button

image

Play button

image

Progress

1/54

Click to flip

54 Cards in this Set

  • Front
  • Back
In Java, a Variable is defined as:
Named memory location that can be assigned a value
Which of the following are relational operators in Java?
<, <=, !=, (NOT =)
<, <=, !=, (NOT =)
Which of the following are relational operators in Java?
<, <=, !=, (NOT =)
<, <=, !=, (NOT =)
A java program begins at?
main()
A statement ends with a ___?
;
Three fundamental pricnaples of OOP are
Encapsulation
PolyMorphism
Inheretence
What are the two floating point types?
Float and Double
Can the modulus operator % be used one floating point values?
Yes, the modulus operatorcan be used on floating point values
What is the width of char?
16
Which of the following would be the most acceptable identifier for a class?
A)My.Class
B)myclass
C)MyClass
D)my_class()
C) MyClass
Logical operators must have boolean operands
True-or-False?
False
Extra space and redundant perentheses should be avoided in an expression because they slow down the execuation of your program
True-or-False?
False
What are the exape sequence for a tab and a backspace
\t and \b
Variables are created when their scope is entered and destroyed when thier scope is exited
True-or-False?
True
What operator is used to access the members of a class through an object?
The dot operator
What does new do?
The new operator allocates memory for an object
Which of the following statements regarding the following statement are true? VEHICLE MINIVAN = NEW VEHICLE();
A)Dynamically allocates memory for an object
B)The new operator allocates memory for a class
C)The new operator passes variable values on an object
D)The new operator only passes int variables to an object
A)Dynamically allocates memory for an object
What return type is used if a method does not return a value?
Void
How does Java reclaim the memory from unused objects?
The garbage collector reclaims the memory from unused objects
A variable for a class object is called an ______ variable
Instance
Each object has its own copies of the instance variables defined by its class
True
What is a class?
A class is a tmeplate that defines the form of an object
What method will allow your program to accept input from the keyboard?
System.in.read()
Can break and continue operate with a label
Yes, both break and continue can operate without a label
The SWITCH expression must be of what type?
Char,byte,short and int
The expression controlling the switch can be of any data type True-or-False
False
To check the condition at the end of the loop us a ______ loop.
Do While
No two case constants in the same switch can have identical values
True
Explain the operation of continue?
The continue statement casues the next ieration of a loop to take place bypassing any intervening code
Explain the operation of continue?
The continue statement casues the next ieration of a loop to take place bypassing any intervening code
Can an else clause exist by itself, with a matching if?
No, an else clause must always be preceded by and if
How do you create an infinite for loop?
for ( ; ; )
What does break do in a switch statement?
Break stops the execution of a statement sequence. This, break can be used to prevent one case from falling into the next.
What are acceptable variable names?
$myVar, _myBar, my$var, my_var, my2var
not; cannot begin with a number or '#', cannot have a '#' in it.
A comment that starts with /*
can extend over multiple lines
and
must end with */
javac Sample.java
java Sample
this sequence of commands would compile and run a main() method in a class called Sample
Jesus help me
What are simple, non object oriented types in Java?
short, long, double
NOT HALF, CHARACTER, and STRING
Instance variables are:
1)Defined within a class
2)Can have different values for each object in a class
A constructor method:
1)Has the same name as its class
2)Initializes an object when the object is created
3)Cant be declared void
A finalize method:
is called just before an object is destroyed by the garbage collector
A java string is:
1)an object
2)unchangable
Class variables:
1)are defined within a class
2)are defined using the keyword static
3)are defined using the keyword dynamic
A java string is:
1)an object
2)unchangable
Class variables:
1)Are defined within a class
2)Are defined using a keyword static
3)Are defined using the keyword dynamic
-An abstract method method must be conained in an abstract class
-An abstract class can contain a mix of abstract and concrete methods
-and abstract class cannot be declared as final
answer above
To prevent a class from being inherited, declare the class ____?
Final
how much can a byte hold?
127
How many times can you call a constructor?
One for each instantiation of its object type
Wehm a class extends from an abstract class, it is optional to override its super abstract methods
False
What kind of class holds an abstract class method?
An interface
The output from javac command is ___?
Bytecode
The result of adding a short to a byte will be a(n) _____ ?
Int
Which of the following is not a Java loop command?
While, For, Do, Loop
Loop
String values can be changed, true or false?
False