From 0dafbcc5cae17133aa4ad222df68fefb13eafcb2 Mon Sep 17 00:00:00 2001 From: Piyush Vishnoi <46771423+Piyushvishnoi@users.noreply.github.com> Date: Thu, 16 Jan 2020 17:02:41 +0530 Subject: [PATCH] use of this keyword --- keywords in java/thiskeyword.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 keywords in java/thiskeyword.java diff --git a/keywords in java/thiskeyword.java b/keywords in java/thiskeyword.java new file mode 100644 index 0000000..169a9ff --- /dev/null +++ b/keywords in java/thiskeyword.java @@ -0,0 +1,21 @@ +class cube +{ + Integer width; + Integer depth; + Integer length; + public void area(Integer width,Integer depth,Integer length) + { + this.width=width; //this keyword is used to remove confusion among same name of variables + this.depth=depth; + this.length=length; + System.out.println(width*depth*length); + } +} +public class thiskeyword { + public static void main(String[] args) { + +cube c=new cube(); +c.area(2,3,4); + } + +}