Write the output for the following statements:
String strl =“Java is Fun”;
String str2 = “amytime”;
System.out.println(str2.replace(m’,’n’));
System.out.println(strl.concat(str2));
Answers
Answered by
1
Answer:
Write a function prototype of the following:
A function PosChar which takes a string argument and a character argument and returns
an integer value.
b) Give the output of the following string functions :
(i) “MISSISSIPPI”.indexOf(‘S’) + “MISSISSIPPI”.lastIndexOf(‘I’)
(ii) “CABLE”.compareTo(“CADET”)
c) Analyze the given program segment and answer the following questions :
(i) Write the output of the program segment
(ii) How many times does the body of the loop gets executed?
for(int m=5; m<=20; m+=5) { if(m%3 == 0) break; elseif(m%5 == 0) { System.out.println(m); continue; } } d) Write the java expression for the following. A2+B3 e) Write the return type of the following library functions : (i) isLetterOrDigit(char) (ii) replace(char,char)
Similar questions