NBKRIST – Java Hub

Infosys Campus Drive – Mentor’s Guidance & Q&A

🌟 MyView

Over the years, I have been part of several IT recruitment panels and have interacted with numerous candidates during campus drives and technical interviews. From my experience, I can confidently say that most interviewers look beyond your marks or how many programs you can memorize. What truly matters is your clarity of thought, sound understanding of fundamentals, and the ability to write efficient, logical code.

My sincere suggestion is — don’t just memorize; understand the concepts, visualize how they work, and learn to apply them in real-world scenarios. Infosys, like most reputed IT organizations, values candidates who think clearly, learn continuously, and can collaborate effectively in team settings.

“Preparation is not about doing everything — it’s about doing the right things with focus, depth, and confidence.”

📚 The Three Pillars of Preparation

☕ Core Java Interview Questions

Benefits include Modularity, Encapsulation, Inheritance, Polymorphism, Abstraction, Maintainability, and Real-world Modeling.

Example – Modularity

class MathUtils { public int add(int a, int b) { return a + b; } } MathUtils util = new MathUtils(); System.out.println(util.add(5, 10)); // 15

Example – Encapsulation

class BankAccount { private double balance; public void deposit(double amount) { balance += amount; } public double getBalance() { return balance; } }

Example – Inheritance

class Vehicle { void start() { System.out.println("Vehicle starts"); } } class Car extends Vehicle { void honk() { System.out.println("Car honks"); } } Car c = new Car(); c.start(); c.honk();

A final variable is a constant whose value cannot change once assigned. For references, the reference remains fixed, but the object state can change.

A constructor is a special method used to initialize objects. It has the same name as the class and no return type.

  • Constructor name = class name; Method name differs.
  • Constructor has no return type; Method has one.
  • Constructor initializes objects; Method defines behavior.
  • Constructor is called automatically; Method explicitly.

Public members can be accessed anywhere, across classes and packages.

Private members are accessible only within the same class, supporting encapsulation.

To enforce encapsulation and ensure data protection via getters/setters.

A static variable belongs to the class, not to any instance, and is shared by all objects.