如果我使用此代码,并使用正确文本的文本文件:
Msg 8120, Level 16, State 1, Line 2
Column 'test.dbo.simpletable.block' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
}
我的输出将是:
package me.ruban.AccountManager;
import java.io.File;
import java.io.IOException;
import java.util.Scanner;`
public class Login {
private String readNickname;
private String readPassword;
private String inputNickname;
private String inputPassword;
private static String[] accountDetails;
private static String line;
private boolean exists = true;
private boolean login = false;
public Login(String inputNickname, String inputPassword) throws IOException {
this.inputNickname = inputNickname;
this.inputPassword = inputPassword;
if(new File(inputNickname + ".acc").exists() == false) {
System.out.println("[Login] This account does not exists!");
exists = false;
}
if(!exists == false) {
try {
Scanner input = new Scanner(new File(inputNickname + ".acc"));
line = "";
while (input.hasNextLine()) {
System.out.println("[Login] Reading...");
line += input.nextLine() + " ";
}
input.close();
System.out.println("[Login] Loaded " + inputNickname + ".acc succesfully.");
} catch (Exception e) {
e.printStackTrace();
}
accountDetails = line.split(" ");
if(accountDetails[0] == inputNickname) {
if(accountDetails[1] == inputPassword) {
login = true;
System.out.println("[Login] Login is aviable!");
}
}
}
}
public boolean getLogin() {
return login;
}
public boolean getExists() {
return exists;
}
public String getLine() {
return line;
}
public static void main(String[]args) throws IOException {
Login l = new Login("username", "password");
System.out.println();
System.out.println(accountDetails[0]);
System.out.println(accountDetails[1]);
System.out.println();
System.out.println(l.getLogin());
}
这不是我想要的,因为根据我的代码和我的文本文件,false应该是真的。所以我的问题是:如何将虚假变为真。
由于