Order the answer to: Intro to JAVA Simple Programing 1. write the code according to the instruction, suchas line o

Academic Help net programming Order the answer to: Intro to JAVA Simple Programing 1. write the code according to the instruction, suchas line o

net programming

Order the answer to: Intro to JAVA Simple Programing 1. write the code according to the instruction, suchas line o

Question /**
Example from R15.1.
Explain what the following code prints. Draw pictures of thelinked
list after each step. Just draw the forward links, as in Figure1.
Add a static method that returns a string representation of thelist
in the form:
list string version
[] /
[A] A -> /
[A,B] A -> B -> /
etc.
The expected output is:
A -> /
B -> A -> /
C -> B -> A -> /
C
B -> A -> /
B
A -> /
A
/
*/
import java.util.LinkedList ;
import java.util.Scanner ;
public class LinkedListTester1
{
public static void main(String[] args)
{
LinkedList list = new LinkedList();
list.addFirst(“A”) ;
System.out.println(toString(list)) ;
list.addFirst(“B”) ;
System.out.println(toString(list)) ;
list.addFirst(“C”) ;
System.out.println(toString(list)) ;
System.out.println(list.removeFirst()) ;
System.out.println(toString(list)) ;
System.out.println(list.removeFirst()) ;
System.out.println(toString(list)) ;
System.out.println(list.removeFirst()) ;
System.out.println(toString(list)) ;
}
/**
A static method that gives a string representation of alinked
list in the form:
list string version
[] /
[A] A -> /
[A,B] A -> B -> /
etc.
@param list the linked list of type LinkedList
@return a string representation like A -> B -> /

Attached

Subject net programming
Ready to try a high quality writing service? Get a discount here