I am new to
java and trying to execute the program below
public class BB {
private static void fun(final int i) {
new
Thread(new Runnable() {
public void run() {System.out.println(i);}
}).start();
}
public static void main(
String[] args) {
System.out.println(1);
fun (2);
System.out.println(3);
fun (4);
System.out.println(5);
}
}
When i run this program output is 1 3 2 5 4 . Can't really understand what's going on with this code? please help