Pensacola State College: Java Programming COP2800

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

length

Each array in Java has a public field named ________________ that contains the number of elements in the array.

ClassB must override each method in ClassA

Given the following code, which statement is true? public class ClassB implements ClassA { }

All of these: 1. You cannot create an instance of the class 2. The method will only have a header, but not a body, and end with a semicolon. 3. The method will be overwritten in the subclasses.

If a class contains an abstract method:

overloaded

If two methods have the same name but different signatures they are:

polymorphic

In Java, a reference variable is ___________ because it can reference objects of types different from its own as long as those types are related to its type through inheritance.

Shape

Line, Circle, and rectangle are subclasses of the ___________ class.

ListView

The Control that displays a list of items and allows the user to select an item from the is the _________ control.

garbage collection

The JVM periodically performs this process to remove unreferenced objects from memory.

an error will occur when the program runs

What will be results of the following code? final int ARRAY_SIZE = 5; float[ ] x = float[ARRAY_SIZE]; for(int i= 1, 0 < i <= ARRAY_SIZE; i; i++) { x[ i ] = 10.0; }

the value variable will contain the lowest in the numbers array.

What will be the result after the following is executed? int [ ] numbers = {40,3,5,7,8,12,10} int value = numbers [0]; for (int i = 1; <numbers.length; i++) { if(numbers [i]<value) value = numbers [i]; }Q

123, 456, and 7890

What will be the tokens for the following code? String str = "123-456-7890"; String [ ] tokens = str.split ("-");

15

What will be the value of position after the following code is executed? int position; String str = "the cow jumped over the moon."; position = str.index Of("ov");

we have lived in Tampa, Trenton, and Atlanta.

What will be the value of str after the following statements are executed? StringBuilder str = new StringBuilder(" We have lived in Chicago, "+" Trention, and Atlanta.");

33

What will be the value of x[1] after the following code is executed? int [ ] x = {22, 33, 44}; arrayProcess(x[ 1 ] ); . . . public static void arrayProcess(int a) { a = a + 5 }

180

What will be the value of x[8] after the following statement are executed? final int SUB = 12; int [ ] x = new int [SUB]; int x = 100; for(int i = 0; i < SUB; i++) { x[ i ] = y; y += 10; }

only one copy of the field in memory

When a field is declared static, there will be:

ChangeEvent

When a user selects an item in a ListView, a _____________ occurs.

private members

When declaring class data members, it is best to declare them as:

Mouse_CLICKED

Which mouse event occurs when the user presses and releases the mouse button?

gridPane.add(myLabel, 1, 0);

Which of the following statements correctly adds a label to the first row and second column of a GridPane object.

public class Salaried extends PayType

Which of the following statements declares Salaried as a subclass of PayType?

myComboBox.setEditable(true);

Which of the following statements will allow a user to type input into a field of a ComboBox named myComboBox?

String str = Double.toString(d);

Which of the following statements will convert the double variable. d = 543.98 to a String

CheckBox CheckOne = new CheckBox ("pizza"); checkOne.set(true);

Which of the following will create a CheckBox that displays pizza and shows up as selected.

double [ ] array1 = new double [10];

Write a single java statement what will declare and instantiate an array that will hold 10 double values:

add

You can use this ArrayList class method to insert an item at a specific location in an ArrayList:

super(name, empID, hireDate); this.Salary = Salary;

Complete the ExemptEmployee constructor: public class ExemptEmployee extends Employee { private double salary; public ExemptEmployee (String name, String empID, String hireDate, double salary) {

9

In the following code, how many times will the for loop execute? String str = ("1,2,3,4,5,6,7,8,9") String [ ] tokens = str.split(" , "); for(String s: tokens) System.out.print(s);

array bounds checking

Java performs ____________, which means that is does not allow a statement to use a subscript that is outside the range of valid subscripts for the array.

1

Look at the following declaration: enum Tree { OAK, MAPLE, PINE } What is the ordinal value of the MAPLE enum constant?

aggregation

Making an instance of one class a field in another class is called:

event driven

Programs that operate in a GUI environment must be:

method overriding

Replacing inadequate superclass methods with more suitable subclass methods is known as what?

static

Static methods can only operate on ______________ fields.

0

Subscript numbering always starts at what value?:

ComboBox

The ____________ control presents a list of items in a drop-down list

setPadding

The ___________________ layout container arranges its contents with columns and rows

if (Character.toUpperCase(choice)=='Y')

The following if statement determines whether choice is equal to 'Y' or 'y' : if (choice == 'Y' || choice == 'y') Rewrite this statement so it makes only one comparison and does not use the || operator.

tokenizing

The process of breaking a string down into tokens is known as what?

registering

The process of connecting an event handler object to a control is called ______________ the event handler.

must be the first statement in the subclass's constructor

The super statement that calls the superclass constructor

substring

The term ___________ commonly is used to refer to a string that is part of another string.

delimiter

The term used for the character that separates token is ______________.

RadioButton

The type of control normally used when you want the user to only be allowed to select one option from several possible is the _______________.

for (int i = 0; i < names.length; i++) System.out.println(names[i]);

The variable names references an integer array with 20 elements. Write a for loop that prints each element of the array on a separate line:

unboxing

This is the process of converting a wrapper class object to a primitive type.

write an equals method that will make a field by field compare of the two objects

To compare two objects in a class:

double x = Double.parseDouble(str);

To convert the string, str = "285.74" to a double, use the following statement:

getItems().setAll()

To replace a ListView control's existing items with a new list of items, use the ________________ method.

it specifies that only string objexts may be stored in the ArrayList object

What does <string> specify in the statement? ArrayList<string>nameList = new ArrayList<string>();

they are called from an instance of the class

What is NOT true about static methods?

setOnAction

What method do you call to register an event handler with a button control?

the address of an object of the class Rectangle

What will be returned from a method, if the following is the method header? public Rectangle getRectangle( )

float

What will be returned from the following method? public static float [ ] getValue ( int x)

only public and protected members of the superclass.

A subclass can directly access _________________.

event

A(n) ___________________ is an action that takes place is an application, such as the clicking of a button.

the account object's toString method will be implicitly called.

Assume the class BankAccount has been created, and the following statement correctly creates an instance of the class: BankAccount account = new BankAccount (5000.0); What is TRUE about the following statement? System.out.println(account);

W

Assuming that str is declared as follows: String str = "RSTUVWXYZ" What value will be returned from str.charAt(5);

ObservableList

Both the ListView control and the ComboBox control keep its list of items in a(n) ________________ object.

(0,479)

Given a window that is 640(width) by 480(height), which of the following represents the lowest position on the left side?

ClassC

Given the following statement, public class ClassA extends ClassB implements ClassC: Which is the interface?

ClassA

Given the following statement, public class ClassA extends ClassB implements ClassC: Which is the subclass?

ClassB

Given the following statement, public class ClassA extends ClassB implements ClassC: Which is the superclass?

overrides

If a method in a superclass has the same signature as a method in the superclass, the subclass ______ the superclass method.

0 through 14

If final int SIZE = 15 and int[ ] x = new int[SIZE], what would be the range of subscript values that could be used with x [ ] ?

this is a public method named add accepts and returns references to objects in the stock class

If the following is from the method section of a UML diagram, which of the statements below is true? +add (object2: Stock): Stock

the program will terminate

If you attempt to perform an operation with a null reference variable:

.root

If you want to apply styles to all nodes in a scene, use the ______________________ selector.

true

If you write a toString method to display the contents of an object, object1, for a class, class1 then the following two statements are equivalent: System.out.println(object1); System.out.println(object1.toString()); True or False?

True

In JavaFX all css properties being with -fx-

the superclass constructor always executes before the subclass constructor

In an inheritance relationship:

start

the Application class's _________________ method is the main entry for a JavaFX application.


Set pelajaran terkait

stat 1430 - homework/practice midterm/old tests for midterm

View Set

Introduction to Business test terms (March)

View Set

Chapter 19 Quizlet Answered long questions

View Set

Life Span/ Human Growth and Development: Final Study Guide

View Set

Physics Final Exam Chapter 8, 7, 6, 5, 4, 3, 2, 1

View Set

Path 370 - Check your understanding (Ch 44, 45, 47, 51, 52)

View Set

Repetitive Motion Injuries (1.00)

View Set

Milady Advanced Esthetics Chapter 10

View Set