0
Dynamic vs static
Can someone help me to understand better when we use a dynamic class or a static class in Java?
2 ответов
+ 1
class SomeClass {
private int a;
static int pow2(int n) {
return n*n;
}
void seta(int a) {
this.a = a;
}
}
if a method use variable that has different values in each instantiation of this class, the method can't be static. ( here seta() )
A static method can be used eg to create a new object.
Integer oi = Integer.valueOf(100)
0
I found this on the internet
https://stackoverflow.com/questions/19519787/when-do-we-use-static-and-dynamic-class-loading