Question
Answered step-by-step

Question 11Question Text: Consider the following line of Java code. '"Hello,World'" is which of the following?

System.out.println("Hello, World!");



Select one:

a. a class

b. a method

c. an object

d. an operator

e. a parameter


Question 12

 Consider the following Java program. Which one of the following is an interface?



import java.awt.event.*;

import javax.swing.*;

public class MouseWhisperer extends JFrame implements MouseListener {

  MouseWhisperer() {

    super("COME CLOSER");

    setSize(300,100);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    addMouseListener(this);

    setVisible(true);

  }

  public void mouseClicked(MouseEvent e) { setTitle("OUCH"); }

  public void mousePressed(MouseEvent e) { setTitle("LET GO"); }

  public void mouseReleased(MouseEvent e) { setTitle("WHEW"); }

  public void mouseEntered(MouseEvent e) { setTitle("I SEE YOU"); }

  public void mouseExited(MouseEvent e) { setTitle("COME CLOSER"); }

  public static void main(String[] args) { new MouseWhisperer(); }

}


Select one:

a. java.awt.event

b. JFrame

c. MouseEvent

d. MouseListener

e. super


Question 13

Which of the following is NOT a valid identifier in Java?


Select one:

a. p

b. Public

c. public

d. public1

e. PuBlIc_oNe


Question 14

Which of the following types is NOT a primitive type?


Select one:

a. boolean

b. char

c. double

d. int

e. String


Question 15

Consider the following Java method.



public static void main(String[] args) {

  System.out.println("Hello, Final!");

}

Which term best describes "void"?


Select one:

a. actual parameter or argument

b. formal parameter

c. modifier

d. return type

e. superclass


Question 16

A subclass method can ___ a superclass method with the same name and parameter types.


Select one:

a. extend

b. implement

c. inherit

d. overload

e. override


Question 17

Which of the following is NOT an effective strategy when your program does not work?


Select one:

a. Make random changes to code that you do not understand until it accidentally works.

b. Read through your code and figure out what it does step by step.

c. Check each error message generated by the compiler or IDE.

d. Add debugging statements to output information about the state of your program while it runs.

e. Use a debugger to pause your program while it is running so you can check its state.


Question 18

Consider the following Java program. Which one of the following best describes "setFlavor"?



public class Food {

  static int count;

  private String flavor = "sweet";

  Food() { count++; }

  void setFlavor(String s) { flavor = s; }

  String getFlavor() { return flavor; }

  static public void main(String[] args) {

    Food pepper = new Food();

    System.out.println(pepper.getFlavor());

  }

}


Select one:

a. a class method

b. a getter method

c. a setter method

d. a public method

e. a static method


Question 19t

Question Text: Consider the following line of Java code. "println" is which of the following?



System.out.println("Hello, World!");



Select one:

a. a class

b. a method

c. an object

d. an operator

e. a parameter


Question 20

What is the output of the following Java program?



public class Food {

  static int count;

  private String flavor = "sweet";

  Food(String s) { flavor = s; }

  void setFlavor(String s) { flavor = s; }

  String getFlavor() { return flavor; }

  static public void main(String[] args) {

    Food pepper = new Food("spicy");

    Food chile = pepper;

    pepper.setFlavor("smoky");

    System.out.println(chile.getFlavor());

  }

}


Select one:

a. false

b. smoky

c. spicy

d. sweet

e. true

Answer & Explanation
Verified Solved by verified expert
Rated Helpful

lestie consequat,a. Fusce dui

cing elit. Nam lm risus ante, d

cing elit. Nam lusce dui

ipsum dolor sit ame vel l

e vel laoreet ac, dtrices ac ma

, ultrices ac magnusce dui

or nec facilisis.s a molestie consequat, ultric

rem ipsum dolor sientesque dapibus

entesque dapibusa molestie

ce dui lectus, coat, ult

Unlock full access to Course Hero

Explore over 16 million step-by-step answers from our library

Subscribe to view answer
Step-by-step explanation

lestie consequat,facilisis. Pellentesqurisus antamet, consecteec

risus ante, dapibus a molestie consequat, ultriceDonec aor nec facilisis. Pellentesque dapibus effic


cing elit. Nam lm risus ante, d

itur laoreet. Nam risus a

, dictum vitae odisque dapirem ipsum dolor sit amet, consectetur adipiscing elit.ongue vel laoreet ang elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet


cing elit. Nam lusce dui

cona molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vit

l

ipsum dolor sit ame vel l

risus ante, dapibus a molestie consequat, ul

ec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequ


e vel laoreet ac, dtrices ac ma

conlfficlce dlsus,ec facilisisit

ac, dictum vitac,dictum viac, dictum vitentesq

m ipsum dolor sit amet, consectetur a


, ultrices ac magnusce dui

ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pum ipsum dolor siu


or nec facilisis.tri

tesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetu


rem ipsum dolor sientesque dapibus

ce dlctum vita molestiel

onec aliquet. Lo

tesque dapibus efficitur laoreet. Nam risus ante, dapibus a


entesque dapibusa molestie

s a molac,dictum viipiscing elit.in

Donec aacinia pulvinartricesa. Fu


ce dui lectus, coat, ult

Fusca. Furis

ur laorefficliaitur laoreet., dictuet, consectetur atricesipiscing elit. Nam lacinia pulvinar tortorur liia pulvitipiscingamipsum dolor sit amet,molestiamet, cceecor ne, dictum vitae oametisumiur licetm ipsum doloamitur laoreet. Nam risussu, ultr, dictuor nec facilisis. Pellentesque dapibus efficitur laoreet. Nrisuso. Donec aliquet. Lac,iscing elit. Nam lacinia pulvinar tortor

facilisis. PelDonec alec facpulvsum dolor sit amet, consectetur adipiscing elrisus, cpulv


m ipsum dolor sit amet, cet, cons

a molesti

Student reviews
100% (4 ratings)

"great great great thanks alot"