Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TestClass {
- private int a = 5;
- private String b;
- TestClass(String newString) {
- b = newString;
- }
- public int getA() {
- return a;
- }
- public void setA(int newValue) {
- a = newValue;
- }
- public void printB() {
- System.out.println(b);
- }
- }
- public class MaxTest {
- public static void main(String[] args) {
- TestClass testClass = new TestClass("Some text");
- System.out.println(testClass.getA());
- testClass.setA(8);
- System.out.println(testClass.getA());
- testClass.printB();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement