Question: import java.util.LinkedList; public class testprintOut { private static LinkedList[] array; public static void main(String[] args) { int nelems = 5; array = new LinkedList[nelems]; for

import java.util.LinkedList;

public class testprintOut {

private static LinkedList[] array;

public static void main(String[] args) {

int nelems = 5;

array = new LinkedList[nelems];

for (int i = 0; i < nelems; i++) {

array[i] = new LinkedList();

}

array[0]=["ab"];

System.out.println(array[0]);

}

}

//I want to create array of linked lists so how do I create them and print them out efficiently?

//Syntax error on token "=", Expression expected after this token

Also, is this how I can put them into hashTable?

public HashTable(int size, HashType type) {

// Initialize

// HashTable(size, type, null); //QQQ

printStats = false;

this.type = type;

nelems = size;

arrayLinkedList = new LinkedList[nelems];

for (int i = 0; i < nelems; i++) {

arrayLinkedList[i] = new LinkedList();

}

}

//Thanks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!