Skip to content

Instantly share code, notes, and snippets.

@devindianushika
Created December 10, 2021 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devindianushika/40b95f366d0ae4f4fd1942a6e59e0950 to your computer and use it in GitHub Desktop.
Save devindianushika/40b95f366d0ae4f4fd1942a6e59e0950 to your computer and use it in GitHub Desktop.
class atm {
private int balance;
public int getbalance(){
return balance;
}
public void setbalance(int balance){
if(balance >=2000){
this.balance = balance;
}
}
}
class Main{
public static void main(String args[]) {
atm boc = new atm();
boc.setbalance(5000);
System.out.println(boc.getbalance());
}
}
@devindianushika
Copy link
Author

Concept of OOP Encapsulation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment