title: How can I get rid of "static"?
body: <p>Here is my code:</p>
  
  <pre><code>public class Main extends JFrame{
  
  static int NoOfUsers;
  static String[][] Accounts = new String[NoOfUsers][2];
  
  public static void main(String[] args){
      Login();
  }
  
  private static void Login() {
      final String FileName = "F:/TextFiles/loginaccs.txt";
      try {
          BufferedReader file = new BufferedReader(new InputStreamReader(new FileInputStream(FileName)));
          int NoOfUsersL = Integer.parseInt(file.readLine());
          String[][] Accounts = new String[NoOfUsersL][2];
          NoOfUsers = NoOfUsersL;
          for (int i=0; i&lt;NoOfUsersL; i++) {
              Accounts[i][0] = file.readLine();
              Accounts[i][1] = file.readLine();
          }
          for (int i=0; i&lt;NoOfUsersL; i++) {
              System.out.println(Accounts[i][0]);
              System.out.println(Accounts[i][1]);
          }
          file.close();
  
      } catch (IOException e) {
          System.out.println("ERROR: unable to read file.");
          e.printStackTrace();   
      }    
  
      String username = null;
      String password = null;
      JTextField usernamejtf = new JTextField(username);
      JPasswordField passwordjtf = new JPasswordField(password);
      String[] buttons = {"Login", "Create new account"};
      Object[] InputDialog = {
              "Username: ", usernamejtf, "Password: ", passwordjtf
      };
  
      do {
  
      int option = JOptionPane.showOptionDialog(null, 
              InputDialog, 
              "Login", 
              JOptionPane.DEFAULT_OPTION, 
              JOptionPane.PLAIN_MESSAGE, 
              null, 
              buttons, 
              buttons[0]);
      System.out.println(option); //Check
  
      if (option == JOptionPane.CLOSED_OPTION ) {
          return;
      }
      else if (option == 0) {
          if (CheckAccount(username,password)) {
              System.out.println("Logged in");
          } else {
              System.out.println("Wrong Password/Username");
          }
      } else if (option == 1) {
          System.out.println("Create Account.");
          }
  
      } while (!(CheckAccount(username,password)));
  }
  
  
  private static boolean CheckAccount(String username, String password) {
      for (int i=0; i&gt;NoOfUsers; i++) {
          if ((username == Accounts[i][0]) &amp;&amp; (password == Accounts[i][1])) {
              return true; 
          }
      }
      return false;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>In "main", I called the Login() method, and Eclipse is forcing me to put the word "static" in front of the method name.<br>
  Is there anyway I can modify the program so that the line can be written as: 
  private void Login() {...};
  private boolean CheckAccount(...) {...} etc.?</p>
  
  <p>[Extra question: 
  Because of the word "static", I can't put something like the word "public" before String[][] Accounts = new String[NoOfUsersL][2];<br>
  Which makes the Accounts array can't be accessed by CheckAccount.
  How can I modify the program to fix this problem as well.]<br>
  Thx everyone in advance.</p>