Consider the following statement written in class Student where school_Name is its data member…
Consider the following statement written in class Student where school_Name is its data member.
static final String school_Name = "Co-Ed School";Which of the following statements are valid for school_Name?
I. All objects of class Student share the same value of school_Name.
II. The value of school_Name cannot be changed during program execution.
III. The keywords static and final cannot be used together for a variable.- (a)Only I and II
- (b)Only II and III
- (c)Only I and III
- (d)Only III
Answer
Answer
AIWritten by AI (antigravity) - it can contain mistakes.
Correct option: (a)
Answer: (a) Only I and II
A static variable is a class variable shared by all instances of the class (Statement I is valid), and a final variable is a constant whose value cannot be modified during execution (Statement II is valid). Keywords static and final can be used together in Java.
From ISC 2026 Computer Science Paper 1, question 1(ii).