import java.util.Scanner;
class this_keyword
{
    int a;//instance
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        this_keyword t=new this_keyword();
        int b=sc.nextInt();//local
        t.a=sc.nextInt();//instance
        System.out.println("Value of Instance variable in main  :"+t.a);
        System.out.println("Value of Local variable in main  :"+b);
        t.m1(b);
        t.m2();
        sc.close();
    }
    void m1(int b)
    {
        int b1=90;
        this.a=100;
        System.out.println("Value of Instance variable  :"+this.a);
        System.out.println("Value of Local variable  :"+b1);
    }
    void m2()
    {
        int z=40;
        System.out.println("Value of Instance variable :"+this.a);
        System.out.println("Value of Local variable z:"+z);
    }
    
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: