Ask Question

a. Is there any functional difference between the class being instantiated in the following two ways? Balanced bal = new Balanced ("abc", "xyz"); Balanced bal = new Balanced ("cab", "zxy"); b. Is there any functional difference between the class being instantiated in the following two ways? Balanced bal = new Balanced ("abc", "xyz"); Balanced bal = new Balanced ("abc", "zxy"); c. Is there any functional difference between the class being instantiated in the following two ways? Balanced bal = new Balanced ("abc", "xyz"); Balanced bal = new Balanced ("xyz", "abc"); d. What type is pushed onto the stack? A char? An int? An integer? explain. e. Under which circumstances is the first opeation performed on the stack (not counting the new operation) the top operation? f. What happens if the string expression, that is passed to the test method, is an empty string?

+5
Answers (1)
  1. 11 July, 20:35
    0
    A, B, C - NO

    D-Value type like int, char ...

    E. pop

    D. it throws null exception

    Explanation:

    (A, B, C) There is no functional difference but as the values passed to the parameterized constructor is different so you will get different outputs but functionality of the class didn't change

    (D) stack is a data structure which stores value types where as heap stores object types. In. stack actual value of the variable stored and heap address of the object stored

    (E) the top operation on stack is always pop once we inserted the elements in a stack. if there are no elements in stack pop results null

    (D) if the string we passed is null or empty to the test method it returns exception we need to handle that
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “a. Is there any functional difference between the class being instantiated in the following two ways? Balanced bal = new Balanced ("abc", ...” in 📗 Computers & Technology 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