大家请看看看这段代码:
package com.xt.game;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
public class Library {
private Customer customer;
private User u = new User();
BookState bookstate = new BookState();
SQLServerDAOFactory factory = new SQLServerDAOFactory();
private BufferedReader read = new BufferedReader(new InputStreamReader(
System.in));
private String login;
public static void main(String[] args) throws NumberFormatException, IOException {
Library library = new Library();
library.start();
}
private void start() throws NumberFormatException, IOException {
// TODO 自动生成方法存根
showWelcomUI();
Bookmanager();
membermanager(u);
borrowBook();
collectbook();
scanbook();
manager();
bye();
}
private void bye() {
// TODO 自动生成方法存根
System.out.println("******************************************");
System.out.println(" 欢迎下次再来 ");
System.out.println("******************************************");
}
private void manager() throws NumberFormatException, IOException {
// TODO 自动生成方法存根
System.out.println("您的身份是管理员:");
if (factory.createCustomerDAO().findUserType(customer).equals("M")) {
System.out.println("1、图书管理");
System.out.println("2、会员管理");
System.out.println("3、借出图书");
System.out.println("4、收集图书");
System.out.println("5、扫描图书");
System.out.println("6、退出 ");
switch (Integer.parseInt(read.readLine())) {
case 1:
Bookmanager();
break;
case 2:
membermanager(u);
break;
case 3:
borrowBook();
break;
case 4:
collectbook();
break;
case 5:
scanbook();
break;
case 6:
bye();
break;
}
}else System.out.println("您的身份是会员");{
}
}
private void scanbook() {
// TODO 自动生成方法存根
customer=new Customer();
}
private void collectbook() {
// TODO 自动生成方法存根
}
private void membermanager(User u2) {
// TODO 自动生成方法存根
System.out.println("欢迎光临");
}
private void borrowBook() {
// TODO 自动生成方法存根
}
private void Bookmanager() {
// TODO 自动生成方法存根
}
private boolean login () throws IOException{
System.out.println("请输入您的账号:");
String UserId=read.readLine();
System.out.println("请输入您的密码:");
String UserPasswored=read.readLine();
customer=new Customer();
customer.setUserId(UserId);
customer.setPassword(UserId);
if (factory.createCustomerDAO().findUserIsExit(customer) != 0)
return true;
return false;
}
private void showWelcomUI() {
// TODO 自动生成方法存根
System.out.println("**********************************************");
System.out.println(" 欢迎光临世纪书城 ");
System.out.println("**********************************************");
}
}
我想让‘欢迎’之后就输出‘输入账号和密码’但却出来个‘**********************************************
欢迎光临世纪书城
**********************************************
欢迎光临
您的身份是管理员:
Exception in thread "main" java.lang.NullPointerException
at com.xt.game.Library.manager(Library.java:57)
at com.xt.game.Library.start(Library.java:39)
at com.xt.game.Library.main(Library.java:26)
’这是怎么回事啊?那位大虾给看看?