Suppose s1, s2, and s3 are three strings, given as follows:
String s1 = "Welcome to Java";
String s2 = "
String s3 = "Welcome to Java";
What are the results of the following expressions?
(a) s 1 == s2
(b) s2 == s3
(c) s1 .equals(s2)
(d) s2.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. last IndexOf ('a')
(1) s1 .1 astlndexOf ("o" , 15)
(m) s1.1ength()
(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.contain(s2)
(v) "\t Wel \t".trim()
Trending nowThis is a popular solution!
Chapter 4 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Additional Engineering Textbook Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
SURVEY OF OPERATING SYSTEMS
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Concepts Of Programming Languages
Degarmo's Materials And Processes In Manufacturing
- Х3: inlTol0 Write a function in Java that implements the following logic: Given a number n, return true if n is in the range 1..10, inclusive. Unless "outsideMode" is true, in which case return true if the number is less or equal to 1, or greater or equal to 10. Your Answer: 1 public boolean in1To10(int n, boolean outsideMode) 2 { 3 } H N Marrow_forwardDraw a flowchart for the Frazzle function.arrow_forwardThis is the issue and must be written in java:Write an application that accepts three specific User strings and shows either You have not entered the words alphabetically or You have entered the strings alphabetically depending on whether the strings were in alphabetic order.arrow_forward
- str is a String object.Write Java statements that finds the number of the alphanumeric characters (letter or digit) in str.Write only the Java statements that performs the above task, nothing else. with javaarrow_forwardIn CORAL LANGUAGE please and thank you! Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part. Ex: If the input is: 130 50 130 the output is: 80 0 80 Hint: Find the smallest value, and then subtract it from all three values, thus removing the gray.arrow_forwardstr is a String object.Write Java statements that prints the characters of str with a space between each character.(Example: if str="Antalya", then output will be "A n t a l y a ")Write only the Java statements that performs the above task, nothing else. with javaarrow_forward
- Java Programming Question 12 I am not sure how to do this question. Any simple input and output would be appreciated.arrow_forwardIn Java code do the following:Write a method that accepts a String as an argument. The method should use recursion to display each individual character in the String:arrow_forwardIn C++ language write the program to read the value of integer n and display the number of ways to reach the top.arrow_forward
- This code must be in Python: START OF PLAY The player starts with 100 points. They have ten attempts (or rounds) to reach 500 points to win. Each round, the player "bets" some amount of points. See gameplay as follows: A HIGH/LOW ROUND (1) The player is shown an initial random card.Cards have a value from 2-14; however, these values are converted to a string as follows: 2-9 are converted to their string equivalent "2", "3", ... "9"10 is "T", 11 is "J", 12 is "Q", 13 is "K" and 14 is "A" (2) After the play sees the first card, they should guess if the next card will be higher (i.e., greater than the current card) or lower (i.e., a lower value than the first card).They will do this by inputting "H" or "L" (lowercase "h" and "l" will also be accepted as valid input). (3) After they input their "high" or "low" guess, the player bets a number of points that their guess will be right. The bet must be between 1 and the total amount of points the player has.1 (4) After the bet amount is…arrow_forwardPythonarrow_forwardTake a string from user and find it's unique identifier of that string in javaarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education