Why this keyword cannot be used in static method.
class Hello{
public static void main(String[] args) {
System.out.println(this);
}
}
Why this keyword cannot be used in static method.
class Hello{
public static void main(String[] args) {
System.out.println(this);
}
}
The main method is static and therefore cannot be accessed with the keyword this
:)
Note: Indeed, the question has been answered already : here