the compareTo() method should be declared outside the main method. i remember this happening to me many times and pulling my hairs when i realised the mistake.
saloni jhanwar wrote:I have been tired to find the reason for illegal start of expression help
That compile time error would also show the line number where this is happening. Have you checked that specific line and code around it? Hint: Pay attention to the line where the implementation of compareTo method has started.
gurpeet singh wrote:the compareTo() method should be declared outside the main method. i remember this happening to me many times and pulling my hairs when i realised the mistake.