Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

*Based on answer choices A-E, what is the code's output?


6. Given the following code, the output is __.


String str = "Java";

System.out.print(str.concat("programming"));


A. Java programming

B. Javaprogramming

C. Java programming !

D. Javaprogramming!

E. !


*Based on answer choices A-E, what is the code's output?


4. Given the following code, the output is __.


String str = new String("persistent");

System.out.print(str.indexOf('e'));


A. 0

B. 1

C. 2

D. 3

E. 4


*Based on answer choices A-E, what is the code's output?


2. Given the following code, the output is __.


String str1 = new String("Apple");

String str2 = "Apple";

System.out.print(str1.equals(str2));


A. 0

B. 1

C. false

D. true

E. str2


*Based on answer choices A-E, what is the code's output?


9. Which describes to check if the letter "a" occurs n times only?


A. a?

B. a+

C. a=

D. a{n}

E. a(n)


*Based on answer choices A-E, what is the code's output?


7. Given the following code, the output is __.


String str = "Nakamori Akina";

System.out.print(str.replaceAll("a", "o"));


A. Nkmri kin

B. NakamoriAkina

C. Nokomori Akino

D. Nokomori Okino

E. Nakamari Akina


*Based on answer choices A-E, what is the code's output?


5. Given the following code, the output is __.


String str = "Yellowstone National Park";

System.out.print(str.length());

A. 15

B. 25

C. 30

D. 20

E. 35


*Based on answer choices A-E, what is the code's output?


#3- Given the following code, the output is __.


String str = new String("flower");

System.out.print(str.charAt(5));


A. 5

B. e

C. w

D. o

E. r


*Given answer choices A-E, what is the code's output?


1. Given the following code, the output is __.


String str1 = new String("Apple");

String str2 = "Apple";

System.out.print(str1 == str2);


Answer Choices:

A. 0

B. 1

C. false

D. true

E. str1 == str2


Write a Java code that uses an input dialog box to ask the user to enter a sentence that may or may not contain a substring, “Ruby”.


Use the an appropriate Java method (e.g. “contains()”) to check if the given string contains the word “Ruby”. If not, display “The substring 'Ruby' is not found.” in a message box. If found, replace every occurrence of the work “Ruby” with “Java”, and then display the revised sentence in a message box.


Test the program three times. First, test the program without the “Ruby” substring. Second, test the program with one occurrence of the “Ruby” substring. Third, test the program with two or more occurrences of the “Ruby” substring.


Create a program that uses a dialog box to ask “Enter a sentence.”, take the user input, and then store the user input in a string variable.


Use the “split()” method to break the address into an array of String type. Then, use a “for..in” (also known as “for..each”)loop to display every word in a one-word-per-line manner in one dialog box.


Then, use: (1) the “toUpperCase()” method to convert every character to uppercase, (2) the toCharArray() method to break the same string literal to an array of char type, and (3) a “for” loop to display every element of the char array in a one-character-per-line manner in another dialog box.


LATEST TUTORIALS
APPROVED BY CLIENTS