Java

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

The operator that combines two conditions into a single Boolean value that is true only when both of the conditions are true, but is false other wise, is ____.

&&

You save text files containing Java source code using the file extension ___.

.Java

In Java, what is the value of 3+7*4+2?

33

The assignment operator in Java is

=

the "equal to" relational operation is _____.

==

Arguments to methods always appear within ___.

Curly braces

Usually, you want each instantiate of a class to have its own copy of ___

The data fields

You can declare variables with the same name multiple times

Within a method

All java applications must have a method named ___.

main()

The method public boolean testValue (int reponse) returns

A boolean value

In Java, methods must include all of the following except ____.

A declaration

The keyword final used with a variable declaration indicates

A symbolic constant

What is the output of the following code segment? t = 10 if ( t > 7) System.out.print("AAA"); System.out.print("BBB");

AAA

The nonstatic data components of a class often are referred to as the ___ of that class

Access types

Suppose you declare an object as Book thisBook; Before you sore data in thisBook you

Also must explicitly allocate memory for it

Which of the following elements is not required in a variable declaration?

An assigned value

Assuming a variable w has been assigned to the value 15, what does the following statement do? w == 5 ? x = 2 : x = 0;

Assigns 2 to x

What is the output of the following code segment? t = 7 if (t > 7) System.out.print("AAA"); System.out.print("BBB");

BBB

An escape sequence always begins with a(n)

Backslash

The body of a class is always written

Between curly braces

The code between a pair of curly braces in a method is a

Block

A decision is based on a(n) ____ value

Boolean

Which of the following data types can store a value in the least amount of memory?

Byte

A constructor ____ overloaded

Can be

The this reference

Can be used implicitly

A constructor ____ parameters

Can receive

Which assignment is correct in Java? Char = W

Char aChar="W";

A program or class that instantiates objects of another prewritten class is a(n)

Class client

Variables that are shared by every instantiate of a class are

Class variables

A public static method named computeSum() is located in classA. to call the method from within ClassB, use the statement

ClassA.computeSum();

Nonexecuting program statements that provide documentation are called

Comments

After you write and save a java application file, you ____ it

Compile and then resave

When stat cannot be changed after a class is compiled, the data is ____.

Constant

Which of the following is typically used in a flowchart to indicate a decision?

Diamond

In a Java program, you must use ____ to separate classes, objects, and methods

Dots

Which assignment is correct in Java? Value = 2.12

Double value = 2.12;

Assuming a variable y has been assigned the value 6, the value of !(y<7) is ____.

False

In Java, the value of (4 > 7) is ____.

False

Objects contain methods and data items, which are also known as

Fields

The concept of allowing a class's private data to be changed only by a class's own methods is known as

Information hiding

The GregorianCalendar class get () method always return a(n)

Integer

The command to execute a compiled Java application is ____.

Javac

Java supports three types of comments: ____ , _____, and javadoc

Line, block

Which of the following groups has the lowest operator precedence?

Logical OR

You send messages or information to an object through its

Methods

Non-ambiguous, overloaded methods must have the same

Name

When a block exists within another block, the blocks are

Nested

When you code an if statement within another if statement, as in the following then the if statements are ____. if (a > b) if (c > d) x = 0;

Nested

Java is architecturally

Neutral

Methods that you reference with individual objects are

Nonstatic

If you use the automatically supplied default constructor when you create an object

Numeric fields are set to 0 (zero)

An instance of a class in a(n)___

Object

Envisioning program components as objects that are similar to concrete objects in the real world is the hallmark of ____

Object-oriented programming

If you create a class that contains one method and instantiates two objects, you usually store ___ for use with the objects.

One copy of the method

A GregorianCalendar object can be created with one of the seven constructors. this means the constructors are

Overloaded

A method variable ____ a class variable within the same name

Override

All method declaration contain

Parenthesis

Most class data fields are

Private

The individual operations used in a computer program are often grouped into logical units called ____.

Procedures

Which of the following is not a type of it statement?

Reserve if

The portion of a program within which you can reference a variable is the variable's

Scope

Which of the following is not a primitive data type in Java

Sector

All java programming statements must end with a ___

Semicolon

The logical structure in which one instruction occurs after another with no branching is a

Sequence

You must compile classes written in Java into

Source code

The values of an object's attributes are also known as its

State

If a class is named Student, the class constructors named is

Student

According to the rule of operator precedence, when division occurs in the same arithmetic statement as _____, the division operation always takes place first

Subtraction

Which java statement produces the following output? w Xyz

System.out.println("w\nXyz");

A boolean variable can hold

The value of true or false

If you declare a variable as an instance variable within a class and you declare and use the same variable name within a method of the class, then within the method

The variable used inside the method takes precedence

You use a ____ to explicitly override an implicit type

Type cast

Named computer memory locations are called ____

Variables

If a method is written to receive a double parameter, and you assign an integer to the method, then the method will

Work correctly, the integer will be promoted to a double

Which of the following is a correct call to a method declared as a public static void aMethod(char code)

aMethod('Q');

You can use the statement to terminate a switch structure

break

The method with the declaration public static char procedure(double d) has a method type of

char

The argument testing in a switch structure can be any of the following except a(n) ____.

double

If you attempt to add a float, an int, and a byte, the result will be a(n)

float

Assuming the variable q has been assigned the value 3, which of the following statements displays XXX?

if ( q >7); System.out.println("XXX");

Which of the following displays "Error" when a student ID is less than 1000 or more than 9999?

if (stuID < 1000 ) System.out.println("Error"); else if (stuID > 9999) System.out.println("Error");

When you perform arithmetic with values of diverse types, Java

implicitly converts the values to an unifying type

The method with the declaration public static int aMethod(double d) has a method type of

int

Java classes are stared in a folder or

package

Which of the following method declarations is correct for a static method named displayFacts() if the method receives an int argument?

public static void displayFacts (int data)

Which of the following could be the last legally coded line of a method declared as public static int getVal(double sum)?

return;

Which of the following statements determines the square root of a number and assigns it to a variable s?

s = Math.sqrt(number);

Assuming you have declared shoeSize to be a variable of type int, which of the following is a valid assignment statement in Java?

shoeSize = 9;

A method is declared as public static void showResults (double d, int i). Which of the following is a correct method call?

showResults(12.2, 67);

The operator that combines two conditions into a single Boolean value that is true when at least one of the conditions is true is ____.

||


Set pelajaran terkait

Physics - Chapter 22 Electrostatics

View Set

Chap 71 Mass Casualty and Disaster Preparedness

View Set

Careers in Health, Hospitality, and Human Services: Mastery Test

View Set

Feeding and Eating Disorders HESI case study

View Set