Skip to main content
1 of 9
user avatar
user avatar

Tips for golfing in Java

I know I know, not another tips question. But I'm rather surprised that this question hasn't already been posted. At any rate, are there any useful shortcuts that can be used especially in Java?

As shown below, packages and imports already add at least 27 characters to a program.

package a;
import java.io.*;

I understand that the simple solution would be to use another language (GolfScript for example), but it seems to be a real challenge to shorten Java programs.

Any tips?

anon