Click here to Skip to main content
15,903,685 members

Comments by John Bob 2021 (Top 11 by date)

John Bob 2021 25-Sep-22 1:11am View    
yes, it should be done like that, but im a little bit confused on how to go about doing it, can you draw a short flow chat or pseudo code as example?
John Bob 2021 24-Sep-22 23:09pm View    
well the assignment question says, Read this data in your Java program by creating a Book class and storing it into a linked list and array list separately. Now do the following:
1. Using polymorphism technique with list data structure as the super class wherever applicable, create the following sorting algorithms:
a. Insertion Sort with a linked list and array list.
b. Exchange sort or Bubble sort with a linked list and array list
John Bob 2021 22-Sep-22 4:00am View    
thank you, the first issue has been resolved, however there's another issue that came up from inside the insertionSort "For loop" and another error is at the main class when calling the insertion sort function. Exception in thread "main" java.lang.ClassCastException: class books.BookList cannot be cast to class java.lang.String (books.BookList is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
John Bob 2021 21-Sep-22 22:51pm View    
Error says non static variable cannot be referenced from a static context, the error is at main function, the line where it's calling the insertion sort function
John Bob 2021 21-Sep-22 22:48pm View    
The question asked me to read a CSV file into a array list and then sort the file. The error occurs at the main function while calling the insertion sort function, it says non static variable cannot be referenced from a static context