public class Tester{
public static void main (String args[]){
String word="sandwich";
char newWord[]=word.toCharArray();
System.out.println(word.equals(transform(newWord)));
if (word.equals(transform(newWord))){
System.out.println("same");}
else{
System.out.println("not");
}
}
public static String transform(char [] newWord){
for(int i=0; i<newWord.length;i++)
{
System.out.print(String.valueOf(newWord[i]));
//System.out.print(""+newWord[i]);
}
return "";
}
}
RESULT>> sandwich false sandwich not
Is there a way to convert a concatenated 'string' of characters to a string literal?