Назад к задачам
Junior
11

Что вернет этот код

Компании, где спрашивали:

IBS
Получайте помощь с лайвкодингом в реальном времени с Sobes Copilot
Условие задачи
public class ATest {
    String global = "111";

    public int parse(String arg) {
        int value = 0;
        try {
            String global = arg; // Shadowing the instance variable
            value = Integer.parseInt(global); // Parsing the local variable
        } catch (Exception e) {
            System.out.println(e.getClass()); // Print exception class
        }
        System.out.print(this.global + " " + value + " "); // Accessing instance variable using 'this'
        return value;
    }

    public static void main(String[] args) {
        ATest ct = new ATest();
        System.out.print(ct.parse("333")); // Calling parse method
    }
}