What will be the output of the following program?
public class TomAndJerry {
int tomAge = 5;
String name = "Tommy";
public TomAndJerry(String name) {
System.out.println("Name is : " + name);
}
public void getAge(int age) {
tomAge = age;
}
public int getAge() {
System.out.println("Tom's age is : " + tomAge);
return tomAge;
}
public static void main(String[] args) {
TomAndJerry tom = new TomAndJerry("Tom");
tom.getAge(2);
tom.getAge();
System.out.println("Value : " + tom.tomAge);
}
}