I am interested in understanding whether there is any difference between initialising an object inside or outside the constructor
public class HTMLTable {
int value1;
Scanner user_input;
public HTMLTable () {
user_input = new Scanner(System.in);
value = user_input.next();
}
}
Instead of:
public class HTMLTable {
int value1;
Scanner user_input = new Scanner(System.in);
public HTMLTable () {
value = user_input.next();
}
}
Can someone explain?