Answers for "how to use this keyword in java with example"

0

this keyword in java

// this keyword in java example
import java.util.*;
class Demo
{
   // instance variable
   int m;
   int n;
   public void setValue(int m, int n)
   {
      m = m;
      n = n;
   }
   public void showValue()
   {
      System.out.println("Value m = " + m);
      System.out.println("Value n = " + n);
   }
}
public class ThisKeywordDemo
{
   public static void main(String[] args)
   {
      Demo obj = new Demo();
      obj.setValue(5, 6);
      obj.showValue();
   }
}
Posted by: Guest on November-24-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language