Answered step by step
Verified Expert Solution
Question
1 Approved Answer
If i have a node list type string, how do i put the data from each node into a string array and print the results?
If i have a node list type string, how do i put the data from each node into a string array and print the results? I am creating the node list myself so i just need generic code how to print the data from each node into a String array.
1670 * 168 * Returns an array of the words in the list, in the order that the client * would expect. * * 169 170 171 172 * * @return an array of all the words in the list * 1730 174 public String[] toArray() { return null; private class Node { private String data; private Node next; 175 176 1770 178 179 180 181 1820 183 184 185 186 187 // Constructs a new node with the specified data private Node(String data) { this.data = data; this.next = null; } * /** * Returns an array of the words in the list, in the order that the client * would expect. * * * * @return an array of all the words in the list * public String[] toArray() { return nullStep 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