Question: Java Questions are in bold. Which of these is a valid way to create a String? (choose all that apply) Question 1 options: String s

Java Questions are in bold.

Which of these is a valid way to create a String? (choose all that apply)

Question 1 options:

String s = "Hello";

String s = new String("Hello");

char[] arr = {'H', 'e', 'l', 'l', 'o'};String s = new String(arr);

String s1 = new String("Hello"); String s2 = s1;

Given the code below, which of these will return the boolean value true?

String s1 = new String( hello ); String s2 = new String( hello );

Question 2 options:

s1 == s2

s1.equals(s2)

s1.compareTo(s2)

s1.sameAs(s2)

What is the output of the following code?

String s1 = This is Java ;if (s1.contains( Java )) {s1 = s1.replaceAll( Java , fun );} System.out.println(s1);

Question 3 options:

Java

fun

This is Java

This is fun

Does the following code show method overriding or method overloading?

public class A {public void echo(String s) { System.out.println(s);}} public class B extends A {public void echo(String s, int x) {for (int i=0; i}}}

overriding

overloading

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!