Created
December 10, 2021 09:31
-
-
Save devindianushika/40b95f366d0ae4f4fd1942a6e59e0950 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Concept of OOP Encapsulation