Listing will not work in Java? I am trying to create a new \"private Listing[] i
ID: 3708409 • Letter: L
Question
Listing will not work in Java?
I am trying to create a new "private Listing[] info" for my program and it will just not work...
It continues to say "cannot find symbol - class Listing"
But as you can see, it is doing it for all Listings.
Please help! I am not sure what I am doing wrong and I have been looking for hours!
My main so far, still does not recognize it.
// instance variables- replace the example below with your own private int top; private int size; private Listing] info; cannot find symbol class Listing /t * Constructor for objects of class Stack public Stack() //initialises instance variables top = -1; size - 100; info - new Listingl size]; x* k Push allows an element to be added * @param none, will add node * @return true or false, based on ability to push public boolean push (Listing newNode) // Checks if stack is not full, and pushes it if so if (isStackFull()) //lets user know stack is being overflowedExplanation / Answer
In java there is no in-built Listing class. You have to define your own Listing class as below.
Listing.java
public class Listing {
// your instance fields and methods
}
But I suppose you want to use a List of numbers or strings.
You can use ArrayList class of java
import java.util.*;
Usage
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(1)
list.add(2);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.