Make all of your fields static if you are just calling them from the Main class. You can’t call an instance field from a static position, as you aren’t currently in an instance. If you wish to keep them non-static, you have to make an instance of DjPageDownloader by putting it in a constructor, and calling that, like so:
public DjPageDownloader() {
    try {
        url = new URL("http://stackoverflow.com/");
        is = url.openStream();  // throws an IOException
        dis = new DataInputStream(new BufferedInputStream(is));
        while ((line = dis.readLine()) != null) {
            System.out.println(line);
        }
    } catch (MalformedURLException mue) {
         mue.printStackTrace();
    } catch (IOException ioe) {
         ioe.printStackTrace();
    } finally {
        try {
            is.close();
        } catch (IOException ioe) {
            // nothing to see here
        }
    }
}
Then call that in your main method:
public static void main(String []args){
    new DjPageDownloader();//If you use it more later, store to a variable, but atm you aren't
}
2
solved how to solve this type of compilation error?