Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Java Programming Study Set 2
Quiz 7: Characters Strings and the Stringbuilder
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 41
Essay
String aName = "Michael" Using the above statement, write the length() method that will return the length of the aName String . What value will the length() method return when executed?
Question 42
Matching
Match each term with the correct statement below.
Premises:
Responses:
Change the length of a string in a StringBuilder object
parseDouble()
Takes two integer arguments: a start position and an end position
buffer
Add characters to the end of a StringBuilder object
String variable
Premises:
Change the length of a string in a StringBuilder object
Takes two integer arguments: a start position and an end position
Add characters to the end of a StringBuilder object
Responses:
parseDouble()
buffer
String variable
Question 43
Essay
yourCounty = "perry"; yourCounty.equals("Perry"); yourCounty.equalsIgnoreCase("Perry"); Using the above statements, what value will be returned by the equals() method? What will be the value of the equalsIgnoreCase() method? Explain how the equalsIgnoreCase() method can be useful when users type responses to prompts in programs.
Question 44
Essay
Describe how a programmer would use the two types of Character class methods (those that begin with "is" and those that begin with "to") for testing the values of characters.
Question 45
Essay
In the above code, two strings are evaluated using the equivalency operator. Why can this be a problem, and what other methods are offered by Java for working with characters and strings?
Question 46
Essay
What is the purpose of the substring() method and how do you use it?
Question 47
Essay
How is the String class equalsIgnoreCase() method like the equals() method and how would you use it? Give an example.
Question 48
Short Answer
String greeting = "Welcome back"; Using the above statement, write the length() method that will return the length of the greeting String . Store the length in an integer named greetingLength .
Question 49
Essay
StringBuilder greeting = new StringBuilder("Welcome home "); phrase.insert(13, "Joe"); Using the above code and insert() method, describe how the phrase will appear after the code executes. How does the insert() method work?
Question 50
Essay
String greeting = "Welcome Home"; Using the above String , create the String method to convert the greeting String to all uppercase. Likewise, create the String method to convert the greeting String to all lowercase.