Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main
- {
- private int num;
- private String alphabet;
- public int getNUM(){
- return ssn;
- }
- public String getAlphabet(){
- return Alphabet;
- }
- public void setAlphabet(String newValue){
- Alphabet = newValue;
- }
- public void setNUM(int newValue){
- num = newValue;
- }
- }
- public class EncapsTest{
- public static void main(String args[]){
- EncapsulationDemo obj = new Name();
- obj.setAlphabet("Mario");
- obj.setNum(112233);
- System.out.println("Enter any letter: " + obj.getAlphabet());
- System.out.println("Enter any number: " + obj.getNUM());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement