Computer Applications
Fill in the blanks:
_________ members are accessible in its own class as well as in a sub class.
Java Classes
18 Likes
Answer
protected
Answered By
2 Likes
Related Questions
Fill in the blanks:
If no access specifier is mentioned then _________ specifier is referred by default.
Fill in the blanks:
_________ members are accessible only within the same class.
Given below is a class based program to accept name and price of an article and find the amount after 12% discount if the price exceeds 10,000 otherwise, discount is nil. There are some places in the program left blank marked with ?1?, ?2?, ?3? and ?4? to be filled with appropriate keyword/expression.
class Discount ( int pr; double d, amt; String nm; Scanner ob = ...?1?... Scanner(System.in); void input( ) { System.out.println("Enter customer's name:"); nm = ...?2?... ; System.out.println("Enter price of the article:"); pr = ob.nextInt( ); } void calculate() { if (...?3?...) d= ...?4?... ; else d = 0; amt = pr - d; } void print() { System.out.println("Name =" + nm); System.out.println("Amount to be paid=" + amt); } }
Based on the above discussion, answer the following questions:
(a) What will be keyword /expression filled in place of ?1?
(b) What will be keyword/expression filled in place of ?2?
(c) What will be keyword /expression filled in place of ?3?
(d) What will be keyword /expression filled in place of ?4?
Why is a class known as composite data type?