Object-Oriented Programming (OOP) is the heart of the ICSE Class 12 Computer Science syllabus in Java. The concepts of "Objects" and "Classes" form the foundation for everything else, from inheritance to data structures. However, students frequently struggle with the conceptual difference between the blueprint and the actual entity in memory.
The Core Problem: Confusing the Blueprint with the Entity
A class is a blueprint; an object is an instance of that class. The most fundamental error students make is treating the class itself as if it holds data. They try to assign values to class variables directly without creating an object first (except for static variables, which is another area of confusion).
Mistake 1: Not Understanding the 'new' Keyword
In Java, declaring an object reference is not the same as creating the object.
Writing Student s1; only creates a reference variable s1 that can point to a Student object. It does not allocate memory for a new student. To actually create the object, the new keyword must be used: s1 = new Student();. A very common exam mistake is trying to call methods or access variables on an uninitialized reference, leading to a NullPointerException in logic and lost marks in theory questions.
Why Constructors Feel Harder Than They Are
A constructor is a special block of code used to initialize an object immediately upon creation. Students often confuse constructors with regular methods.
The crucial differences must be memorized: a constructor has the exact same name as the class, and it has NO return type (not even void). A common mistake in coding questions is writing public void Student() { ... }. By adding void, the student accidentally turns the constructor into a regular method named "Student," meaning the object state will not be initialized when new Student() is called.
Mistake 2: Mixing Up Default, Parameterised, and Copy Constructors
Questions frequently ask students to identify or write different types of constructors.
A default constructor takes no arguments. A parameterised constructor takes arguments to set initial values based on user input. A copy constructor takes an object of the same class as an argument to create a duplicate. The mistake students make is assuming the compiler will always provide a default constructor. If a parameterised constructor is explicitly defined, the compiler does not provide a default one. Trying to instantiate new Student() in this scenario will cause a compilation error.
The Difference Between Static and Non-Static Members Is More Detailed Than Students Think
This is perhaps the most tested concept in OOP basics. Non-static (instance) variables belong to the object. Static (class) variables belong to the class itself.
If you have a static variable schoolName in the Student class, all Student objects share that single variable. If one object changes it, it changes for everyone. Students often erroneously use instance variables where static variables are needed (like counting the total number of objects created). Furthermore, a static method cannot directly access non-static instance variables because it doesn't belong to any specific object. Violating this rule is a classic syntax error in board practicals.
Mistake 3: Misunderstanding Pass-by-Value vs. Pass-by-Reference
When passing arguments to methods, students misunderstand what actually gets passed in Java.
Java is strictly pass-by-value. However, when passing an object reference, the value of the reference (the memory address) is passed. Therefore, if a method modifies the state of the object passed to it (e.g., s.changeName("Alice")), the original object is modified. But if the method tries to reassign the reference to a completely new object (e.g., s = new Student()), it only affects the local copy of the reference, not the original reference in the calling method. Confusing these two scenarios leads to incorrect output prediction in tracing questions.
Start practising Computer Science MCQs here to master these concepts and permanently fix these mistakes.