What are the results of the following expressions? Verify your results via eclipse (using System.out.print()). Submission • Just answers. a. s1 == s2 b. s2 == s3 c. s1.equals(s2) d. s1.equals(s3) e. s1.compareTo(s2) f. s2.compareTo(s3) g. s2.compareTo(s2) h. s1.charAt(0) i. s1.indexOf('j') j. s1.indexOf("to") k. s1.lastIndexOf('a') l. s1.lastIndexOf("o", 15) m. s1.length() n. s1.substring(5) o. s1.substring(5, 11) p. s1.startsWith("Wel") q. s1.endsWith("Java") r. s1.toLowerCase() s. s1.toUpperCase() t. s1.concat(s2) u. s1.contains(s2) v. "\t Wel \t".trim()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Suppose that s1, s2, and s3 are four strings, given as follows: (5 points)
String s1 = "Welcome to Java";
String s2 = "Programming is fun";
String s3 = "Welcome to Java";


What are the results of the following expressions? Verify your results via eclipse (using System.out.print()).
Submission
• Just answers.


a. s1 == s2
b. s2 == s3
c. s1.equals(s2)
d. s1.equals(s3)
e. s1.compareTo(s2)
f. s2.compareTo(s3)
g. s2.compareTo(s2)
h. s1.charAt(0)
i. s1.indexOf('j')
j. s1.indexOf("to")
k. s1.lastIndexOf('a')
l. s1.lastIndexOf("o", 15)
m. s1.length()
n. s1.substring(5)
o. s1.substring(5, 11)
p. s1.startsWith("Wel")
q. s1.endsWith("Java")
r. s1.toLowerCase()
s. s1.toUpperCase()
t. s1.concat(s2)

u. s1.contains(s2)
v. "\t Wel \t".trim()

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education