The default value of an array of Strings (e.g., String [] names;) after it has been declared but before it has been built?
What is a null reference?
Before it has been built with the new keyword, a String array has a default value of a null reference
In Java, what is the formal term for the "blueprint" that defines the properties and behaviours of an object?
what is a class?
Blueprint: The formal term for the blueprint of an object is a class
Which keyword represents a self-reference to the current object in scope?
What is this?
The keyword this represents a reference to the current object in scope
What is the name of the root class that acts as the direct or indirect superclass for every class in Java?
The Object class is the direct or indirect superclass of every class in Java
what will the following output?
class GFG {
// Main driver method
public static void main(String[] args)
{
GetSet obj = new GetSet();
// Calling method 1 inside main() method
obj.setNumber(5);
// Printing the number as setter above
System.out.println(obj.getNumber());
}
}
5
If you build an array with 10 slots using new String, what is the index of the first slot and what is the index of the last slot?
what is 0 (first index) and 9(last index)?
For an array of 10 slots, the first index is 0 and the last index is 9
What is the fundamental difference between a mutable object and an immutable object?
A mutable object can change its state after creation, while an immutable object (like a String) cannot be modified once created
What are the two primary restrictions on enum constants regarding their modification and instantiation?
What is implicitly static and final?
Enum constants are implicitly static and final (cannot be modified), and you cannot use the new operator to create an object of an enum type
Java follows the rule of "Single Inheritance"; what does this imply for any subclass you create?
This rule means a subclass can extend one and only one superclass
To call the constructor of the direct super-type from a subclass: ________( );
**super**( );
To declare and build an array of integers with 20 rows and 10 columns, the syntax is:
int [] [] numbers = new int [20] [10]. (rows come first in array declarations)
To build a 2D array of size 20 by 10, use: int [][] numbers = new int [ ] [ ];
In the context of "Things a class can do," which specific type of method is considered a "query" that does not change the object's state?
What is a getter?
A "Getter" method is considered a query because it asks for data and returns it without changing the object's state
How does a static variable (class variable) differ from an instance variable in terms of how data is shared across multiple objects?
Unlike instance variables which are object-specific, static variables are shared across all instances of a class; only one copy exists in memory
What is the difference between Method Overloading and Method Overriding, specifically regarding the method signature?
Overloading requires different parameter lists, while Method Overriding requires the method signature to match the inherited one exactly to replace its implementation
what is happening to the Human class in the following

constructor overloading
This loop iterates over every element in an array, performing an action with each element until it reaches the end
what is an enhanced for loop?
Its purpose is to iterate over every element in an array, performing an action for each element until the end of the array is reached
Why are instance variables typically assigned private access modifiers, and what principle of object-oriented programming does this follow?
Instance variables are private to ensure "data hiding" and follow the principle of least privilege, preventing direct outside access
Explain the concept of "shadowing" when a constructor parameter has the same name as an instance variable.
Shadowing occurs when a local variable or parameter has the same name as an instance variable, making the instance variable inaccessible unless you use the this reference
How does the protected access modifier facilitate inheritance while still maintaining more restrictions than public?
The protected keyword allows a variable or method to be accessed by subclasses and other classes within the same package
what type of relationship is happening between healthplan and benefit?

inheritance
If you use the Arrays.binarySearch() method from the java.util.Arrays utility class,What state must the array be in for the search to return a valid index?
What is ascending order?
Binary Search Condition: For Arrays.binarySearch() to return a valid index, the array must be sorted into ascending order first
If you create two separate Poodle objects (fifi and fifisClone) using the exact same parameters, why will fifi == fifisClone return false?
fifi == fifisClone is false because they are two separate objects with different reference addresses in memory, even if their internal data is identical
In class composition (a "has-a" relationship), if a Person object contains an Address object, what is the specific order of constructor execution on the call stack?
In a "has-a" relationship, the contained object (the part) is typically initialized first within the constructor of the containing object (the whole)
During polymorphism, how does the "static type" of a reference differ from the "dynamic type" of the object in determining which method executes?
The static type (the reference type) determines if a method can be called, while the dynamic type (the actual object type) determines which version of an overridden method executes
what does the following output?
class Student{
String name = "Vishnu";
int age = 21;
@Override
public String toString(){
return "Student{name='" + name + "', age=" + age + "}";
}
public static void main(String[] args) {
Student s = new Student();
// Calls overridden toString()
System.out.println(s.toString());
}
}
Student{name='Vishnu', age=21}