Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the following code what will be printed? String s1= cat; String s2= cat; if(s1 == s2) { System.out.println(s1 + is the same string as
In the following code what will be printed? String s1= "cat"; String s2= "cat"; if(s1 == s2) \{ System.out.println(s1 +" is the same string as " +s2); \} else if (s1.equals(s2))\{ System.out.println(s1+" is the same word as " +s2); \} else \{ System.out.println("The two strings are different"); \} A. cat is the same string as cat B. cat is the same word as cat C. The two strings are different D. There is a syntax error and the code will not compile. E. cat is the same string as cat cat is the same word as cat Review Check to review before finishing (will be flagged in Table of Contents) Question 2 of 4 (worth 4 points) In the following code what will be printed? String s1= "cat"; String s2= "Cat"; if(s1 == s2) \{ System.out.println(s1+" is the same string as " +s2); \} else if (s1.equals(s2))\{ System.out.println(s1 + " is the same word as " +s2); \} else \{ System.out.println("The two strings are different"); \} A. cat is the same string as Cat B. The two strings are different C. There is a syntax error and the code will not compile. D. cat is the same string as Cat cat is the same word as Cat E. cat is the same word as Cat In the following code, what will print? double x=2.5; double y=2.52; double tolerance =0.01; if (Math.abs (xy)
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