I have the given array
val things = arrayOf<Any>("Jack", 8, 2, 6, "King", 5, 3, "Queen", "Jack");
Below is the code I have used
things.set(things.indexOf("Jack"), 11);
things.set(things.indexOf("Queen"), 12);
things.set(things.indexOf("King"), 13);
things.sort();
things.set(things.indexOf(11), "Jack"));
things.set(things.indexOf(12), "Queen");
things.set(things.indexOf(13), "King");
things.joinToString(":");
things.forEach { System.out.print(it) }
Here is the error I keep getting
Unexpected tokens (use ';' to separate expressions on the same line)
Expecting an element
After removing the trailing bracket, I now get the following error
Exception in thread "main" java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap')
at java.lang.String.compareTo (:-1)
at java.util.ComparableTimSort.binarySort (:-1)
at java.util.ComparableTimSort.sort (:-1)
things.set(things.indexOf(11), "Jack"));