Write a method called newTest(String input) that accepts one input. Input is a string stored as a variable called input and returns nothing back. Method should test to see if the string’s first and last characters are the same and should disregard case. Use a string method that converts to either lower or upper case. Convert the string to its character array and test the first and last characters. If they are the same, print to System.out "same"; else, print "not". At this point I am struggling to extract the characters and plug them into "if". public static void main(String[] …

Member Avatar
Member Avatar
+0 forum 1

I need help showing me where I went wrong. Given problem is. Print to System.out a new string composed of every alternate character in sentence starting with the first. Use a loop to go through a string and retrieve characters from alternate index positions. Append these characters to another string and print. Output should equal "pes ep" The code I have so far is... I am confident that the System.out parameters are wrong, but I might also have something else wrong. I could use help fixing. String sentence = "please help" int num1="0" sentence.charAt(num1); for (num1 = 0; num1 <= …

Member Avatar
Member Avatar
+0 forum 4

I need to write a loop to go through a string and retrieve alternate characters from index positions. Then append the characters to another string and then print (eg. "pleasehelp" = "peshl") I have hit a wall and lack any sort of know how to push through... what have I got myself into? All I have is below. string sentence = "please help"; char[] charSentence = sentence.toCharArray(); for (sentence);

Member Avatar
Member Avatar
+0 forum 1

The End.