When to use 0L?

I'm puzzled by this.

Why is

long myVar= 0;

not ok and

long myVar= 0L;

recommended? Should every value that I want to assign to a long end with an L?

Why is

long myVar= 0;

not ok

It IS OK.

and

long myVar= 0L;

recommended?

It makes it clear that you are assigning a long value to a long variable. No implicit promotion is needed. Explicit is always better than implicit.

Yes, exactly, the L means that the constant is long, so you have to use it if you want to assign it correctly to long variable.
0L is 32 bit constant in compare with 0 which is just 16bit and upper bytes stay unchanged in the first case.

You only have to use it when you have a calculation involving a bunch of constants that do fit in 16bits and an intermediate result that doesn't.

For the case of 0 it is totally superfluous. 0 is 0 no matter how many bits you take.