To The New interview questions

Practice 68+ real To The New interview questions covering coding, technical, project, and HR rounds. Prepare smarter for To The New placement interviews.

Preview Questions

  1. Why do we need interfaces when we have abstract classes?

    We need interfaces because they provide a way to achieve multiple inheritance and ensure loose coupling between classes. While abstract classes can define both abstract and concrete methods, a class can inherit from...

  2. Is method overloading applicable in inheritance?

    Yes, method overloading is applicable in inheritance. When a child class defines a method with the same name as a method in the parent class but with different parameters (either in number or type), it is considered...

  3. What is Method Hiding?

    Method Hiding occurs when a child class defines a static method with the same name and signature as a static method in its parent class. In this case, the child method hides the parent method instead of overriding it....

  4. What is constructor chaining in Java ?

    Constructor Chaining in Java means calling one constructor from another within the same class or between a parent and child class. It helps reuse initialization code and avoid repetition. We use the this() keyword to...

  5. Can we overload and override a constructor?

    We can overload a constructor but cannot override it. Constructor overloading happens when a class has multiple constructors with the same name but different parameters, allowing objects to be initialized in different...

  6. Why is the String class immutable? Is it final?

    Yes, the String class is final and immutable in Java. This means once a String object is created, its value cannot be changed. The main reasons are security, caching, and thread-safety. For example, Strings are often...