FRQ 1 Methods and Control Structures with String Objects
Sometimes you will find that FRQ #1 Methods and Control Structures involves manipulating String objects. This article has some tips that are specifically meant for this case where we have to use String objects in an FRQ.
- It's a String, so deal with it as a String. Do not try to change it into a different type, like using charAt and assigning the return value to a char variable. Does this work? Sometimes. Is it probably less straightforward than just using the String methods? Absolutely! Remember that the questions are written with the AP Java Subset in mind.
- Use the AP Java Subset. Speaking of the AP Java Subset, the most straight-forward way to answer your FRQ is to use what is provided in the AP Java Subset. You can earn credit for correct solutions written outside the AP Java Subset, but the authors of the exam, literally write the questions to fit within the subset, you should too. ;)
- Access the AP Java Reference Sheet. If you can't remember the methods available for String objects, you can access the AP Java Quick Reference and see a list of them in their. You can access this in Bluebook and should try it out in advance of the exam.
- Read the Methods Descriptions. While you have that reference sheet in front of you, be sure to double check the method descriptions. Often points are lost for being off by one on a String. Don't remember where substring starts and ends? Read the AP Java Quick Reference, it tells you.
- Remember Strings are Immutable. Immutable objects are unable to change. If you need to alter the value of a String, you have to create a new String and assign the variable to this value. The substring methods return new String objects that have the value equivalent to part of the original String object. In order to update the original String, you need to assign it to this new value. Using methods like Be sure that you know what being immutable means for your solution.
Best of luck!! Wishing for you all to earn 5s.
More Resources