Not sure what you mean by "Is the output possible: Thread-0 runs before main" - you're observing it, so obviously it's possible.
Since the "B"
thread is put to sleep, the JVM will choose some other thread to run, and the "A" thread is the only other user thread in existence - so this behavior is to be expected.