Chapter Table of ContentsSubsection Table of ContentsPracticeInitializeWithout EndFirst HalfString Slicer
Let's practice initializing different primitive types. In the code below (see downloads), there are variables initialized, but they don't have a type! Based on the name of the variable and its value, write the correct type in front of the variable's name so that the program works. (Be sure to uncomment everything when you begin working.)
There may be more than 1 correct answer.
Given 3 strings that are at least 2 characters long, print each string without its first and last character. Hint: Use the length() method on a string to get the number of characters that make up that string.
Given 3 strings of even length, print the first half of each string. Hint: Use the length() method on a string to get the number of characters that make up that string.
Use String Methods to convert the following strings to the results:a) "A Tale of Two Cities" -> "WO CIT"b) "A Handmaid's Tale" -> "s"c) "wE LoVe tO CoDe" -> "e love to code"