public class StringNode { private char ch; private StringNode next; public StringNode(char c, StringNode n) { ch = c; next = n; } public static StringNode convert(String s) { // code to check for empty string goes here StringNode firstNode = new StringNode(s.charAt(0), null); StringNode prevNode = firstNode; StringNode nextNode; for (int i = 1; i < s.length(); i++) { nextNode = new StringNode(s.charAt(i), null); prevNode.next = nextNode; prevNode = nextNode; } return firstNode; } public static void toUpperCase(StringNode str) { StringNode trav = str; while (trav != null) { trav.ch = Character.toUpperCase(trav.ch); trav = trav.next; } } public static void main(String[] args) { StringNode s1 = StringNode.convert("cat"); StringNode.toUpperCase(s1); } }