Implémentez la variable statique statique statique, le bloc statique, la fonction statique et la classe statique avec des conditions suivantes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Java program demonstrate execution of static blocks and variables
 
import java.util.*;
 
public class VariableExample
{
// static variable
static int j = n();
 
// static block
static {
System.out.println("Inside the static block");
}
 
// static method
static int n() {
System.out.println("from n ");
return 20;
}
 
// static method(main !!)
public static void main(String[] args)
{
System.out.println("Value of j : "+j);
System.out.println("Inside main method");
}
}
Said HR