Well it helps if you can post the exact error message you are getting. However in this case I imagine the problem is that you haven't initialised f. The variable f is still null because you haven't called the JFrame constructor, you have only defined it as being a JFrame. You cannot call any methods on a null variable. Change the code to this:
Miguel and Stuart are correct; splitting the declaration into two lines doesn't change the meaning at all, and in fact the compiler will very likely emit the identical bytecode in both cases.
Since we're quibbling over small details, however, I can't help but remark that Stuart's comment on the first line that "f is still null here" isn't quite right. f's value at that point is undefined; if you tried to read the value, the compiler would reject the code because f hasn't been initialized. If f were a member, then it would be automatically initialized to null, but that's not the case for locals.