Can I declare something like this??
static volatile boolean first=false;
Sure. The effects of the two modifiers are completely orthogonal.