MCQOPTIONS
Bookmark
Saved Bookmarks
→
Java Programming
→
Exceptions
→
What will s2 contain after following lines of code..
1.
What will s2 contain after following lines of code?
A.
onetwo
B.
twoone
C.
one
D.
two
E.
None of these
Answer» B. twoone
Show Answer
Discussion
No Comment Found
Post Comment
Related MCQs
In the below code, which code fragment should be inserted at line 3 so that the output will be: 234pqr 234pqr ?<br><pre class="prettyprint lang-c"><br>1. StringBuilder strbuilder = new StringBuilder("234");<br>2. String str = "234";<br>3. // insert code here<br>4. System.out.println(strbuilder + " " + str);<br></pre>
What will s2 contain after following lines of code?<br><pre class="prettyprint lang-c"><br>String str1 = "one";<br>String str2 = str1.concat("two")<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class Result <br> {<br> public static void main(String args[])<br> { <br> String ch = "hello i love interview mania";<br> boolean var0;<br> var0 = ch.startsWith("hello");<br> System.out.println(var0);<br> }<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class Result <br> {<br> public static void main(String args[])<br> {<br> String ch[] = {"p", "q", "p", "s", "t"};<br> for (int K = 0; K < ch.length; ++K)<br> for (int L = K + 1; L < ch.length; ++L)<br> if(ch[K].compareTo(ch[L]) == 0)<br> System.out.print(ch[L]); <br> }<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">public class Result <br> {<br> public static void main(String args[])<br> {<br> String str1 = "Interview Mania";<br> String str2 = str1.substring(0 , 9);<br> System.out.println(str2);<br> }<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class output <br> {<br> public static void main(String args[])<br> { <br> String str1 = "Intervzew Manza";<br> String str2 = str1.replace('z','i');<br> System.out.println(str2);<br> }<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class Result <br> {<br> public static void main(String args[])<br> { <br> String str1 = "Interview";<br> String str2 = str1 + " Mania";<br> System.out.println(str2);<br> }<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class Result <br> {<br> public static void main(String args[])<br> { <br> String str0 = " Interview mania ";<br> String str1 = str0.trim();<br> System.out.println(" ""+str1+" "");<br> }<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class Result <br> {<br> public static void main(String args[])<br> { <br> String str1 = "Hello";<br> String str2 = new String(str1);<br> String str3 = "HELLO";<br> System.out.println(str1.equals(str2) + " " + str2.equals(str3));<br> }<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class output <br> {<br> public static void main(String args[])<br> { <br> String str1 = "Hello i love interview mania";<br> String str2 = new String(str1);<br> System.out.println((str1 == str2) + " " + str1.equals(str2));<br> }<br> }<br></pre>
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply