Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Pad 19:23 90% 2014-15. s3.amazonaws com 6 of 10 Term 2- Week 3 Name: Magpie Lab:

ID: 3783952 • Letter: P

Question

Pad 19:23 90% 2014-15. s3.amazonaws com 6 of 10 Term 2- Week 3 Name: Magpie Lab: Part 4 -Activity 3-String APIs This activity asks you to work with the String class. While we covered this class back in Term 1. his activity asks you to investigate and use some of the methods in the String class that are not covered on the APCSA Exam. In order to use these methods you need to read the String class' API. An API (Application Programming Interface is a listing of the features and behaviors of a system that tell a programmer how to use them. We have looked at these several times this year in the lessons and webinars, specifically for the Math and String classes. Class String This screenshot on the left shows the String API. This information at the top shows where the String class fits in to the hierarchy of all of the Java cl asses, and gives some information abouthow it works. On the right the shows the beginning of method summary listing everything available through the String class. the Use the String API to answer he following: 1. How many constructors are in the String class? 2. How many indexof methods are in the String class? 3, What does the replaceA11 (string regex, String replacement) method do? 4. Are there any methods there that would have made the TweetTester lab casier to complete?

Explanation / Answer

Q. How many constructors are in String class ?
   There are total 15 constructors. 11 are depricated.

   These four constructors are not depricated:
   String()
   Initializes a newly created String object so that it represents an empty character sequence.
   String(byte[] bytes)
   Constructs a new String by decoding the specified array of bytes using the platform's default charset.
   String(byte[] bytes, Charset charset)
   Constructs a new String by decoding the specified array of bytes using the specified charset.
   String(byte[] ascii, int hibyte)

Q. How amny indexOf methods are in String class ?
   There are 4 indexOf methods are in String class.

Q.
   replaceAll(String regex, String replacement)
   Replaces each substring of this string that matches the given regular expression with the given replacement.

Hi Friend you have not posted 'findKeyword' method, so I am not able to answer Magpie Lab question.
You have also not posted 'TweetTester Lab' question