Java Chapter 7

¡Supera tus tareas y exámenes ahora con Quizwiz!

immutable

A String is an example of an object that can't be changed, also known as _____.

reference

A String variable name is a _____ which is a variable that holds a memory address.

True

A String variable name is not a simple data type.

null

A String variable that does not yet hold a memory address is known as a(n) _____ String.

Buffer

A StringBuilder object contains a memory block called a _____, which might or might not contain a string.

Stringbuilder

A ____ is a class for storing and manipulating changeable data that is composed of multiple characters.

Anonoymous

A literal string is a(n) ____ object.

literal string

A sequence of characters enclosed within double quotation marks is a _____.

Lexicographical

A(n) ____ comparison is based on the integer Unicode values of the characters.

Refrence

A(n) ____ is a variable that holds a memory address.

False

Any string value that is input into a program can be used in arithmetic operations.

ParseDouble()

Besides Double and Integer, other wrapper classes such as Float and Long also provide ____ methods that convert Strings to the wrapper types.

StringBuilder

For an alternative to the String class, and so you can change a String's contents, you can use _____.

2

If String movie = new String("West Side Story");, the value of movie.indexOf(′s′) is _____.

False

If you try to use an index that is less than 0 or less than the index of the last position in the StringBuilder object, you cause an error known as an exception and your program terminates.

True

In a compare To() method, programmers often do not need specific return values but want to determine if a value is positive or negative.

concatenation

Joining Strings with a '+' is called _____.

oneStr.regionMatches(0, twoStr, 0, 7)

String oneStr = "Welcome Jim" String twoStr = "Welcome Joe" Given the lines of code above, which of the following regionMatches() expressions will result in a value of true?

Immutable

Strings and other objects that can't be changed are known as ____.

Concatenation

System.out.println("Your name is " + yourName); The above statement is an example of ____, which is used to join Strings.

Inherits

The Character class ____ from java.lang.Object.

java.lang

The Character class is defined in _____.

Equals()

The String class ____ method evaluates the contents of two String objects to determine if they are equivalent.

every occurrence of a character in a String with another characte

The String class replace() method replaces _____.

False

The StringBuffer class is more efficient than the StringBuilder class because it can execute multiple threads during program execution.

Replace()

The ____ method allows you to replace all occurrences of some character within a String.

toString()

The ____ method converts any object to a String.

Insert()

The ____ method lets you add characters at a specific location within a StringBuilder object.

Length()

The ____ method returns the length of a String.

ParseDouble()

The ____ method takes a String argument and returns its double value.

buffer

The actual length of the _____ is the capacity of the StringBuilder object.

16

The creators of Java chose ____ characters as the "extra" length for a StringBuilder object.

int is a primitive type; Integer is a class

The difference between int and Integer is _____.

is position zero

The first position in a String _____.

public boolean equals(String s)

The method header of the equals() method within the String class is ____.

String to an integer

The method parseInt() converts a(n) _____.

equalsIgnoreCase()

The method that determines whether two String objects are equivalent, regardless of case, is _____.

substring()

The method that extracts a string from within another string is _____.

To

The methods of the Character class that begin with ____ return a character that has been converted to the stated format.

immutable

The term that programmers use to describe objects that cannot be changed is _____.

False

The terms "literal string" and "string literal" are entirely different in Java programming.

all of the above: float b. char d. in

The toString() method converts a(n) _____ to a String.

setChartat()

To alter just one character in a StringBuilder, you can use the ____ method, which allows you to change a character at a specified position within a StringBuilder object. Question options:

Integer

To convert a String to an integer, you use the ____ class, which is part of java.lang and is automatically imported into programs you write

new

To create a String object, you can use the keyword _____ before the constructor call, but you are not required to use this format.

new

Unlike when you create a String, when you create a StringBuilder, you must use the keyword _____.

CompareTo()

When the String class ____ method is used to compare two Strings, it provides additional information to the user in the form of an integer value.

True

When using the pre written equals() method, a true or false comparison between two Strings is returned, but you do not know how the code looks behind the scenes.

False

When working with Strings, it is necessary to explicitly set a String to null.

False

When you compare Strings with the == operator, you are comparing their values, not their memory addresses.

Value of 10

When you declare a variable of a basic, primitive type, such as int x = 10;, the memory address where x is located holds the ____.

True

When you must determine whether a String is empty, it is more efficient to compare its length to 0 than it is to use the equals () method.

String greeting = "Hello";

Which of the following correctly declares and initializes a String object?

toUpper()

Which of the following is not a commonly used Character method?

String

You can tell that the equals() method takes a ____ argument because parentheses are used in the method call.


Conjuntos de estudio relacionados

NJVS - Personal Financial Literacy - Unit 6.3: Home and Property Insurance

View Set

中1 理科 生物の観察 身近な生物の生活と種類

View Set

World History Chapter 7 - The Hebrews and Judaism

View Set

Multiple Sclerosis (ATI) & Lupus

View Set

Chapter 3: The Neuronal Membrane at Rest

View Set

Unit 9 Review Electricity Physics

View Set

Week 3 - Fair Credit Reporting Act (FCRA)

View Set

HW 7.1-7.4 Correlation and Causality

View Set