Question
Q.Write a method public static void reverse(LinkedList strings) that reverses the entries in a linked list.? pls help my program is not working //importing required
Q.Write a method public static void reverse(LinkedList strings) that reverses the entries in a linked list.?
pls help my program is not working
//importing required packages import java.util.LinkedList; import java.util.Stack; //class ReverseLinked public class ReverseLinked { //main method public static void main(String[] args) { //declarating linked list LinkedList
These are the errors that I get when I compile this program.
/tmp/java_3RBy5s/ReverseLinked.java:32: warning: [unchecked] unchecked call to push(E) as a member of the raw type Stack st.push(strings.get(i)); ^ where E is a type-variable: E extends Object declared in class Stack /tmp/java_3RBy5s/ReverseLinked.java:39: warning: [unchecked] unchecked call to add(E) as a member of the raw type LinkedList strings.add(st.pop()); ^ where E is a type-variable: E extends Object declared in class LinkedList 2 warnings
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started