Question: JAVA HELPPPP PLEASE Consider the example from section 1.3 below: StackOfStrings s = new StackOfStrings(); while (!StdIn.isEmpty()) { String item = StdIn.readString(); if (!item.equals(-)) s.push(item);

JAVA HELPPPP PLEASE

Consider the example from section 1.3 below:

StackOfStrings s = new StackOfStrings(); while (!StdIn.isEmpty()) { String item = StdIn.readString(); if (!item.equals("-")) s.push(item); else if (s.isEmpty()) StdOut.println("BAD INPUT"); else StdOut.print(s.pop() + " "); }

Suppose the input is " one two three - four five - - six - seven " What would be the third word in the output?

Question 7 options:

two

three

four

six

none of these

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!