Computer Applications
What is encapsulation?
Encapsulation & Inheritance in Java
28 Likes
Answer
The process of wrapping or grouping of data and functions in such a way that they are used as a single unit is known as encapsulation.
Answered By
20 Likes
Related Questions
State whether the following statement is True or False :
A single target inheriting many bases is known as multilevel inheritance.
A number is said to be Armstrong if the sum of cube of its digits is equal to the same number.
For example,
153 = 13 + 53 + 33
Hence, 153 is an Armstrong number.A program using a class is designed below to check and display whether a number 'num' is an Armstrong number or not. There are some places in the program left blank marked with ?1?, ?2?, ?3? and ?4? to be filled with suitable condition/expression.
class Armstrong { private int num; Armstrong(int n) { num = n; boolean check( ) { int nm = num; while(...?1?...) { digit = nm % 10; sum = sum + ...?2?... ; nm = ...?3?... ; } if (sum == num) return(true); else return(false); } void display( ) { boolean ch = check( ); if(ch == ...?4?... ) System.out.println("Number is Armstrong"); else System.out.println("Number is not Armstrong"); } } }Based on the above discussion, answer the following questions:
(a) What will be filled in place of ?1?
(b) What will be filled in place of ?2?
(c) What will be filled in place of ?3?
(d) What will be filled in place of ?4?
In what way does a class enforce data hiding?
What are the types of visibility modes used in Java?