Multiple choice technology programming languages

package exceptions; public class TestException4 { static String trimString(String x) { return x.trim(); } public static void main(String[] args) { try { String s = trimString(" tcs "); System.out.println("s = "+s); } finally { System.out.println("In finally"); } } }

  1. s = tcs In finally

  2. Compiler Error

  3. Exception

  4. s = tcs

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The trimString() method calls x.trim() which removes leading/trailing whitespace. On input ' tcs ', this returns 'tcs'. The finally block always executes, so output is 's = tcs' followed by 'In finally'. No exception occurs, so flow is normal.