You need to look up the grammar to understand that. Look in the
Java® Language Specification (=JLS), and it says:-
DoStatement:
do Statement while ( Expression ) ;
That means that whatever goes after do and before while must fulfil the requirments to be a statement. Something like
int p = 10;
is not a statement, but a declaration and initialisation. Please work out what you can do with the declaration, and you should find an explanation why the grammar doesn't allow declarations there. I think you will find the same if you look up if or while statements in the JLS, too.