Horje
encapsulation in oop Code Example
encapsulation in oop
The meaning of Encapsulation, is to make sure that "sensitive" data is hidden from users.
it is like the pojo classes in andorid studio


To achieve this, you must :::
    1. declare class variables/attributes as private
    2. provide public get and set methods to access and update the value of a private variable


example :::
    public class Another {

        private int a;
        private int b;
        private int c;
    
        public Another(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }
    
        public Another(){
            // default
        }
    
        public int getA() {
            return a;
        }
    
        public int getB() {
            return b;
        }
    
        public int getC() {
            return c;
        }
    
        public void setA(int a) {
            this.a = a;
        }
    
        public void setB(int b) {
            this.b = b;
        }
    
        public void setC(int c) {
            this.c = c;
        }
    }




Java

Related
dagger kapt dependency and plugin Code Example dagger kapt dependency and plugin Code Example
immagini java Code Example immagini java Code Example
count vowels in java Code Example count vowels in java Code Example
java read string input Code Example java read string input Code Example
TextInputEditText click event Code Example TextInputEditText click event Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7