Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. class TestClass {
  2.     private int a = 5;
  3.     private String b;
  4.  
  5.     TestClass(String newString) {
  6.         b = newString;
  7.     }
  8.  
  9.     public int getA() {
  10.         return a;
  11.     }
  12.  
  13.     public void setA(int newValue) {
  14.         a = newValue;
  15.     }
  16.  
  17.     public void printB() {
  18.         System.out.println(b);
  19.     }
  20. }
  21.  
  22.  
  23. public class MaxTest {
  24.     public static void main(String[] args) {
  25.         TestClass testClass = new TestClass("Some text");
  26.         System.out.println(testClass.getA());
  27.         testClass.setA(8);
  28.         System.out.println(testClass.getA());
  29.         testClass.printB();
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement