I am very new to Java and am in a Java intro class so I apologize if this question is offensively simple but I am wondering if it is possible to set a string equal to a method. I guess I already know the answer is no
I am very new to Java and am in a Java intro class so I apologize if this question is offensively simple but I am wondering if it is possible to set a string equal to a method. I guess I already know the answer is no because Netbeans is throwing an error but I just don't know another way to program this question:
"Create a new string called passwd formed by concatenating every alternate non-space character in sentence ('sentence' is a string she had us create earlier in the assignment) starting with the first. To do this, you need to a loop to go through the string sentence and retrieve characters from alternate index positions. If the extracted alternate character is NOT a space, then add it to the new String. Do not include spaces."
With my limited Java knowledge all I can think to do is to set a new string equal to a "for" method, but apparently this isn't allowed. How would I do this?