[Solved] “Non-static variable cannot be referenced…” in my main method? [duplicate]


If you want to keep the following variables outside main method, declare them with static keyword as follows:

static Statement stmt;       
static ResultSet rs;

Alternatively, place them as they are inside main method.

1

solved “Non-static variable cannot be referenced…” in my main method? [duplicate]