Question: 1. Write a java method that given a string, computes a new string by moving the first char to come after the next two chars,
1. Write a java method that given a string, computes a new string by moving the first char to come after the next two chars, so "abc" yields "bca". Repeat this process for each subsequent group of 3 chars, so "abcdef" yields "bcaefd". Ignore any group of fewer than 3 chars at the end. Here are some sample method calls and the expected output:
oneTwo("abc") -> "bca"
oneTwo("tca") -> "cat"
oneTwo("tcagdo") ->"catdog"
2. Write a single java statement that declares and initializes an array of type String called schoolDays that is populated with the five names of the typical school days (Monday through Friday)
3.Write a standard for loop that will output each of the elements of the schoolDays array on a separate line.
4.Given the following declaration, int[] grades = new int[10]; Write the java statement that assigns 87 to the fifth element in the array, grades.
5.Write a statement to store the number of elements of a char array called letters into the int variable called numletters.
6.Write a series of java statements that declare an ArrayList of String objecs called seasons and add to the ArrayList the names of the four seasons.
7.Write an enhanced for loop that will output each of the items of the seasons ArrayList on a separate line.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
