String content = "SELECT * FROM " + "floor" + floor + " WHERE Roomnumber ='" + roomresult + "'";
System.out.println("next query->" + content);
statement.execute(content);
ResultSet rs = statement.getResultSet();
Date u = rs.getDate("CheckIn");
I want to transform the java.sql.date into java.util.date. I think the final sentence is correct , but the java told me that there is a NullPointerExceptio
statement.executeQuery(content), else you won't have a resultjava.util.Dateanyway. Even if you had to load ajava.sql.Datefrom the database, it's best to convert it to the appropriate class fromjava.time. It's also possible to get the value as the appropriate type usinggetObjectin most modern JDBC drivers.