Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose that s1 , s2 , and s3 are three strings, given as follows: String s1 = Welcome to Java; String s2 = Programming is

Suppose that s1 , s2 , and s3 are three strings, given as follows:

String s1 = "Welcome to Java"; String s2 = "Programming is fun"; String s3 = "Welcome to Java";

What are the results of the following expressions?

s1.charAt(0)

s1.indexOf('j')

s1.indexOf("to")

s1.lastIndexOf('a')

s1.lastIndexOf("o", 15)

s1.length()

s1.substring(5)

s1.substring(5, 11)

s1.toLowerCase()

s1.toUpperCase()

s1.concat(s2)

"\t Wel \t".trim()

Suppose that s1 and s2 are two strings. Which of the following statements or expressions are incorrect?

String s = "Welcome to Java"; String s3 = s1 + s2; String s3 = s1 - s2; s1 == s2; s1 >= s2; s1.compareTo(s2); int i = s1.length(); char c = s1(0); char c = s1.charAt(s1.length());

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

More Books

Students also viewed these Databases questions

Question

\f\f\f\f

Answered: 1 week ago

Question

25.0 m C B A 52.0 m 65.0 m

Answered: 1 week ago