From d02c0f2d6bf075b5e57fd5c0eae249aab26021e5 Mon Sep 17 00:00:00 2001 From: Gifty <87938653+Giffff@users.noreply.github.com> Date: Mon, 22 Nov 2021 17:24:26 +0530 Subject: [PATCH] Showing the functioning of static in java --- DAY8/Static.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 DAY8/Static.java diff --git a/DAY8/Static.java b/DAY8/Static.java new file mode 100644 index 0000000..cb55911 --- /dev/null +++ b/DAY8/Static.java @@ -0,0 +1,27 @@ + +public class Hi{ +static int a; +int b; +public static void main(String args[]) +{ +Hi h=new Hi(); +Hi h2=new Hi(); +h.a=10; +System.out.println("The value storing in h object of a:"+h.a); +h2.a=20; +System.out.println("The value storing in h2 object of a:"+h.a); +System.out.println("The value now in h object of a as it is static:"+h.a); + + +h.b=56; +System.out.println("The value storing in h object of b:"+h.b); +h2.b=90; +System.out.println("The value storing in h2 object of b:"+h2.b); +System.out.println("The value now in h object of b:"+h.b); + +} + +} + + +