+ 1

What is the difference between having something static or not.

pls reply with static and without static

20th Nov 2017, 10:51 AM
Cooki10
Cooki10 - avatar
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... 😃😃
20th Nov 2017, 11:24 AM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar
0
static method will just used by classes . that means any class which you created can call this method
20th Nov 2017, 11:03 AM
Nadin
Nadin - avatar