From the following Java code determine the attributes of the class student:…

2013

From the following Java code determine the attributes of the class student: class student { string name; int marks; }; public static void main() { student S1 = new student(); student S2 = new student(); }

  1. A.

    Only name

  2. B.

    Both name and marks

  3. C.

    Only S1

  4. D.

    Both S1 and S2

Attempted by 435 students.

Show answer & explanation

Correct answer: B

Answer: The class student has two attributes declared inside it. name — string

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Up Lt Grade Assistant Teacher 2025