Ask Question
26 December, 15:03

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 () + " "); }

+1
Answers (1)
  1. 26 December, 15:32
    0
    Explanation

    Question 1:

    ! StdIn. isEmpty () is false.

    So, it does not run the loop body.

    So, It does not print anything.

    Answer:

    none of these

    Question 2:

    If we print the list starting at x, the result would be: 2 3

    Answer:

    none of these
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “StackOfStrings s = new StackOfStrings (); while (! StdIn. isEmpty ()) { String item = StdIn. readString (); if (! item. equals ("-")) s. ...” in 📗 Engineering if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers