Question: QUESTION 1 Consider the following: StringTokenizer st- new StringTokenizer (Java programming is fun!); while (at hasMoreToken()) System.out.printin(st.nextToken()); How many times would the while loop execute?




QUESTION 1 Consider the following: StringTokenizer st- new StringTokenizer ("Java programming is fun!"); while (at hasMoreToken()) System.out.printin(st.nextToken()); How many times would the while loop execute? 07 0 1 QUESTION 2 Which one of the following wrapper classes would be appropriate for the char data type? StringBuilder Integer Character String QUESTION 3 method To remove leading and trailing whitespace characters from a string object, use the remove compress concat QUESTION 4 A string that is extracted from another string is called a: Onested string literal substring delimiter QUESTION 5 Consider the following: boolean matches: String stri- "The cow jumped over the moon.", String str2 - moon; matches - stri.endsVith(str2); System.out.println(matches): What output will be displayed? true moon false The cow QUESTION 6 Consider the following: String stri "The quick brown tox jumped over the lazy dog."; String str2 - str1.subatring (20, 26); System.out.println(str2); What output will be displayed? On fox O jumped O lazy d x jump QUESTION 7 Consider the following: String str - "RSTUVWXYZ"> System.out.println(atr.charAt(5)); What output will be displayed? OW OV OU QUESTIONS Consider the following: String str - "redigreensblue forange" string() tokens - str.aplit("E**#]"); for (String : tokena) System.out.print ( + " "); What output will be displayed? red green blue orange Red $ green & blue #orange $ red [$] green [$] blue ($] orange QUESTION 9 Which of the following is needed if the programmer intends to use the StringTokenizer class? import java.util.Scanner import java.text.Decimal Format; import java.util.StringTokenizer: import javax.swing.JOption Pane; QUESTION 10 You can concatenate String objects by using the concat or trim methods. using the concat method or the + operator. O using the concatenate or join methods. O using the concatenate method or the + operator
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
