+ 1
What is the difference between having something static or not.
pls reply with static and without static
2 Answers
+ 7
static methods or variables can be called without creating any instance of that class.
For example imagine a class named Calculator and its static method Sum()
here.....
Calculator c= new Calculator();
System.out.print(c.Sum(20,25));
we can do this if the Sum method is static..
System.out.print(Calculator.Sum(20,25));
You see I could use the Sum method without creating any instance of Calculator class.
Hope it helped... đđ
0
static method will just used by classes . that means any class which you created can call this method