• 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

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/4

Click to flip

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;

4 Cards in this Set

  • Front
  • Back
Which of the following identifiers are valid?

applet, Applet, a++, --a, 4#R, $4, #44, apps
applet, Applet, $4,apps
Which of the following are Java keywords?

class, public, int, x, y, radius
class, public, int
Translate the following algorithm into Java code:
Step1: Declare a double variable named miles with initial value 100;
Step2: Declare a double constant named MILE_TO_KILOMETER with value 1.609;
Step3: Declare a double variable named kilometer, multiply miles and MILE_TO_KILOMETER, and assign the result to kilometer.
Step4: Display kilometer to the console.
What is kilometer after Step4?
Step1: double miles = 100;
Step2: final double MILE_TO_KILOMETER = 1.609;
Step3: double kilometer = MILE_TO_KILOMETER * miles;
Step4: The value of kilometer is 160.9
What are the benefits of using constants? Declare an int constant SIZE with the value 20.
3 benefits:
1) You don't have to repeatedly type the same value.
2) The value can be changed in a single location, if necessary
3) The program is easy to read


final int SIZE = 20;