Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (10 points) Suppose that s1, s2, and are four strings, given as follows: String s1 = Welcome to Java; String s2 = Programming is

1. (10 points) Suppose that s1, s2, and are four 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? Solve the problems below using eye. Then use Eclipse to verify your answer. 1) System.out.println(s1 == s2); 2) System.out.println(s2 == s3); 3) System.out.println(s1.equals(s2)); 4) System.out.println(s1.equals(s3)); 5) System.out.println(s1.compareTo (s2)); 6) System.out.println(s2.compareTo(s3)); 7) System.out.println(s2.compareTo(s2)); 8) System.out.println(s1.charAt(0)); System.out.println(s1.indexOf('j')); 10) System.out.println(s1.indexOf("to")); 11) System.out.println(s1.lastIndexOf('a')); System.out.println(s1.lastIndexOf("o", 15)); 13) System.out.println(s1.length()); 9) 12) 14) System.out.println(s1.substring(5)); 15) System.out.println(s1.substring(5, 11)); 16) System.out.println(s1.startsWith("Wel")); 17) System.out.println(s1.endsWith("Java")); 18) System.out.println(s1.toLowe

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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

What is the danger in expressing fixed costs on a per unit basis?

Answered: 1 week ago