Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started