Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public class Main
  2. {
  3. private int num;
  4. private String alphabet;
  5.  
  6. public int getNUM(){
  7. return ssn;
  8. }
  9.  
  10. public String getAlphabet(){
  11. return Alphabet;
  12. }
  13.  
  14. public void setAlphabet(String newValue){
  15. Alphabet = newValue;
  16. }
  17.  
  18. public void setNUM(int newValue){
  19. num = newValue;
  20. }
  21. }
  22. public class EncapsTest{
  23. public static void main(String args[]){
  24. EncapsulationDemo obj = new Name();
  25. obj.setAlphabet("Mario");
  26. obj.setNum(112233);
  27. System.out.println("Enter any letter: " + obj.getAlphabet());
  28. System.out.println("Enter any number: " + obj.getNUM());
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement