Q:

static variable declaration in class java

Why is this declaration wrong? This declaration leads to identifier expected error 
class Abc{
    static ArrayList<Integer> p;
    p = new ArrayList<Integer>(); // identifier expected error
} 

A:

You have a freestanding assignment statement in your class body. You can't have step-by-step code there, it has to be within something (an initializer block, a method, a constructor, ...). In your specific case, you can:

Put that on the declaration as an initializer
static ArrayList<Integer> p = new ArrayList<>();

Wrap it in a static initialization block
static {
    p = new ArrayList<Integer>();
}

More in the tutorial on initializing fields.

