if( currentTimeslot.isEmpty()){
System.out.println("Do stuff");
}
How come I get a NullPointerException? How do I check whether a string is NULL and do stuff if it is? Whenever currentTimeslot is equals to NULL I get the error. Here is the console message:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at PM.ui.MainFrame.getJPanelTopMenu(MainFrame.java:382)
Try the following
if( currentTimeslot == null){
System.out.println("Do stuff");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With