// methods4 DIS // print vs return class Test { int x; int add(int y) { return x+y; } } public class methods4 { public static void main(String[] args) { Test t = new Test(); // return a value // note: nothing prints! int a = t.add(1); // print a value System.out.println(a); // now combine the two lines into more concise code: System.out.println(t.add(1)); // Java evaluates t.add(1) first. That code returns a value. // The println() method THEN prints the value that was returned. } } /* output 1 1 */