Example #1
0
  public static void main(String[] args) throws Exception {
    AccountApp a = new AccountApp();
    Scanner sc = new Scanner(System.in);

    while (true) {
      System.out.println("1 - Write\n2 - Show\n3 - Remove");
      String stroka = sc.nextLine();
      if (a.select(stroka)) {
        System.out.println("Enter any key");
        sc.nextLine();
        continue;
      }
    }
  }
Example #2
0
  public void write() throws SQLException {
    Scanner sc = new Scanner(System.in);
    System.out.println("Text");
    String text = sc.nextLine();

    System.out.println("Prioritet");
    int prioritet = sc.nextInt();
    Account account = new Account();
    account.setText(text);
    account.setPrioritet(prioritet);
    Dao<Account, String> accountDao = connect();
    accountDao.create(account);
    System.out.println("Enter some string to continue");
    sc.next();
    connectionSource.close();
  }