1int a = 20;
2int b = 20;
3public static int sum(){
4 return a + b;
5} // Return Function
6public static void sum(){
7 System.out.println(a + b);
8} // Void Method. it Prints and does not return anything
1 // a method for computing the area of the rectangle
2 public int getArea() {
3 return width * height;
4 }
1A return statement causes the program control to transfer back to the caller of a method.
2