My homework assignment this three-line poem and I have to put them together and get each of the six combinations possible with named constants and escape sequences. I created a string for each line but how do I string them all together without getting them on the same line? I tried using \n but it gives me errors wherever I place it... I also don't know where to use a named constant in this code. This is what I have so far:
I know I have to create poems 2-6, but I figured this code was example enough. Thank you for any help or suggestions!
public class Lion { public static void main (String [] args) { String lineA = "I saw a wild yellow lion."; String lineB = "The wild yellow lion saw me."; String lineC = "Oh! What a terrifying experience!"; String poem1 = lineA + lineB + lineC; System.out.printf(poem1); } }
I know I have to create poems 2-6, but I figured this code was example enough. Thank you for any help or suggestions!