मराठी

Consider the following statement written in class Circle where pi is its data member. static final double pi = 3.142; Which of the following statements are valid for pi? - Computer Science (Theory)

Advertisements
Advertisements

प्रश्न

Consider the following statement written in class Circle where pi is its data member.

static final double pi = 3.142;

Which of the following statements are valid for pi?

  1. It contains a common value for all objects class Circle.
  2. Its value is non-changeable.
  3. At a time two access modifiers, static and final, cannot be applied to a single data member pi.

पर्याय

  • I and II

  • II and III

  • I and III

  • Only III

MCQ

उत्तर

I and II

Explanation:

Statement I and Statement II are valid because pi is static, meaning it contains a common value for all objects of the class Circle, and pi is final, meaning its value is non-changeable.

shaalaa.com
Object as an Instance of a Class
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2024-2025 (April) Specimen Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×