What is the output of the following code?
class Student { void m1() { // Invoke the m2() method this.m2(); // same as "m2();" } void m2() { int this = 10; System.out.println(this); } } public class Main { public static void main(String[] args) { Student s = new Student(); s.m1(); } }
// An error. Cannot name a variable this int this = 10;
this is a reserved keyword, you cannot use it as variable name