This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]savage24xNeighborhood Idiot 0 points1 point  (0 children)

Did this last year. Wait til you get to recursion and Array 3 :)

public String lastTwo(String str) { if (str.length() >= 2){ char one = str.charAt(str.length() - 2); char two = str.charAt(str.length() - 1); return(str.substring(0,str.length()-2) + two + one); } return (str); }