Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavapattern matching switch instanceofSingle-choice MCQ

What is the scope of the binding variable `s` in this if statement?

void f(Object o) { if (!(o instanceof String s)) { return; } System.out.println(s.length()); }