Sobes.tech
Junior — Senior

Analysis and improvement of the class

livecode

Task condition

The example shows a class Abstract with two private final fields (int a and String b) and two constructors. It is required to review the code and suggest optimization options.

package com.jetbulb.interviews;

public class JetbulbInterview {
    public static void main(String[] args) {
    }
}

class Abstract {
    private final int a;
    private final String b;

    public Abstract(int a) {
        this.a = a;
    }

    public Abstract(int a, String b) {
        this.a = a;
        this.b = b;
    }
}