import java.lang.*;
public class GrammerStack extends GrammerStructure implements StringStack {
private String structName;
private int cap;
public GrammerStack(String structureName, int limit){
this.structName = structureName;
this.cap = limit;
System.out.println(structName+"["+cap+"]");
}
public void GrammerStructure(String structureName){
this.structName = structureName;
}
//Empty overrides.
public String[] asArray(){};
public String push(String item) throws FillException{};
public String pop() throws EmptyException{};
public boolean contains(String query){};
public void empty(){};
public double fillPercent(){};
public String getName(){ return structName; }
public void main(String args[]){
GrammerStack("Stack1",3);
}
}
When I run: javac GrammerStack.java
I get the following:
GrammerStack.java:15: cannot find symbol
symbol : constructor GrammerStructure()
location: class GrammerStructure
public GrammerStack(String structureName, int limit){
^
GrammerStack.java:41: cannot find symbol
symbol : method GrammerStack(java.lang.String,int)
location: class GrammerStack
GrammerStack("Stack1",3);
^
2 errors
I can’t figure out what is going wrong here, my method is not mismatched to the name of the file, either. “Grammer” is correct in this case.
Any help?
For first problem, add
super(structureName);as first line in constructor. I assume you havepublic GrammerStructure(String name)constructor defined in super class. If this is not the case, please share your constructor.For second problem, you are missing the keyword
new. Change below:with
or