Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. After the following code is executed, the conditional expression s1 == s2 will evaluate to _____________ . String s1 = new String(Pears); String s2

1.

After the following code is executed, the conditional expression s1 == s2 will evaluate to _____________ .

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

Group of answer choices

false

true

2.

Which of the following will NOT result in a NullPointerException when str has the null value?

Group of answer choices

if ( str == null || str.isEmpty() ) { }

if ( str == null && str.isEmpty() ) { }

if ( str.isEmpty() || str == null) { }

if ( str.isEmpty() && str == null) { }

3.

Given the following code segment, which of the following are true?

String s1 = new String("Java"); String s2 = new String("Java"); String s3 = s2;

Group of answer choices

s2.equals(s3)

s1 == s2

s2 == s3

s1.equals(s2)

s1 == s3

4.

What is printed out?

char chr = 'B'; char out = 'W'; if ( chr == 'A') { out = 'X'; } if ( chr == 'B') { out = 'Y'; } if ( chr != 'A' || chr != 'B') { out = 'Z'; } System.out.print(out);

Group of answer choices

Y

W

X

Z

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions

Question

Draw a picture consisting parts of monocot leaf

Answered: 1 week ago