I have commented my code with what I think every line of my Q does.
logically it should be working. Saddly I get one compiling error and
when I debug it out, I find that I get a null exception error in the
remove statement.
the logic of my main file seems sound and I'm feeling decent about my
buffer and such. I have the car set up, but with a broken engine :(
can someone help me figure out whats going on?
INSERT:
REMOVE:
logically it should be working. Saddly I get one compiling error and
when I debug it out, I find that I get a null exception error in the
remove statement.
the logic of my main file seems sound and I'm feeling decent about my
buffer and such. I have the car set up, but with a broken engine :(
can someone help me figure out whats going on?
INSERT:
Code:
if(front==null) {//if q is empty then... node newnode = new node();//create a now node named "newnode" newnode.item =any; //new node is filled with whatever is read in "string any" front.link=newnode;//what ever is in newnode is attatched to the front //rear=newnode; //out.printf("%sNODE",any); } else {//otherwise... node newnode= new node(); //creat a new node newnode.item =any;//fill that new node with what is read in from any newnode.link=front;//link this new node to the front rear=newnode;//end of string is equal to the place of the new node //out.printf("%sNODE",any); }
Code:
if(front !=null) { //if front is not empty item_t place= front.item; //place is equal to what is inside front front=front.link;} //front is moved to the next item in the list return place;//return the value of front if (empty ()) {throw new NoSuchElementException (); return null;}//if front is empty through an error and return nothing.