Govt. Exams
Entrance Exams
Evaluation: (true && false) || true = false || true = true. AND operator (&& has higher precedence than OR (||).
This is valid method overloading. Two methods with same name but different parameters (method signature) is allowed in Java.
Variables declared inside a method have local scope and are only accessible within that method. They are destroyed when the method returns.
Static variables are initialized only once when the class is first loaded into memory, regardless of object creation.
Private members are not inherited. They remain accessible only within the class they are declared in.
Static variables are shared among ALL instances of a class, not individual copies per object.
Following operator precedence: 5%2=1, 3*2=6, then 1+6-1=6
Constructors can be overloaded based on parameter count and types, but not on return type.
protected allows access within the same package and to subclasses even outside the package.
== compares object references (memory location), while .equals() compares the actual string content.