Question: Question 2 Part A Given the following method int methodACint x, int return-1 else r CYeturn o else return 1 What would be returned for
Question 2 Part A Given the following method int methodACint x, int return-1 else r CYeturn o else return 1 What would be returned for the following calls: methodA(3, 3)O methodA (5,4) m. methodA (20,30 v. In general, what does the method return? Are there any other cases to take into consideration that are not covered by the above three calls? Answer either "No", or provide such a case. v. vi. Rewrite the method eliminating the if statements; instead use conditional operators only Part B Given the following method: String restof (String s) ( return s.substring(1); What is returned by each of the following expressions: i. "" restOf("Hello") i. restOf(restOf(restoff"cowboy")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
