So I didn’t make those variables static so again you know I have to make those variable static if I don’t wanna do not.
Want to make them static again I have to use the object I’ll show you that process also but this is the property of static methods that you can only use the static variable inside a static method okay so now if I’ll run this in the output I will see the number which is the maximum and that is 40 okay now let’s just discuss.
Why we are earlier getting there.
There was no static keyword okay so now these are non static variable and I’m trying to use this inside static method which is not possible so if my variables are non static I can simply create the object of the class or nay of classes this give it an object reference let’s say obj equals to new static example okay now you’re fine I.
Can use it now using the object so I’ll say obj dot a now.
It’s fine and obj dot B now again if I’ll run this and you get the right output okay so I’m just copy this line and I’ll show you what we did earlier earlier we.
Were using like this if the variables were static if they are non static just create their object and use it as it is okay so you know this is how we work with the static there are so many points you know when we work with the rest assured libraries we’ll deal with the static method so we should know it you know how.
To make the import and how to use it so these are.
The you know the few main points that only static variables can be used inside a static method and non-static variable can be used but you have to create the object of it right the old why why and when we create a method static basically for the functionalities that should not be dependent on the object okay or the common functionality functionality that is common among all the objects or that.
And again okay so forth in these cases we make a method or a variable static I hope it’s clear to you now okay so again if you have any.
From this session you can write it in the comment box below and I will get back to you if you like this video subscribe to the channel for the more videos like this thank you.