+ 5
How to know that when we have to use 'static' keyword nd when not ?!!😐😶
2 Respostas
+ 2
Static make a variable, a method reachable by all children of the parent class and without instanciate the parent class. Very usefull to create services.
+ 1
For ex.:
public class Program{
static int check(int a, int b){
return a + b;
}
public static void main(String[] args) {
System.out.print(check(1, 99));
}
}
---
Static method you can call without new Object.