Im calling DataComparison()
public class SteganographyGUI {
...
DataComparison dataComp;
dataComp = new DataComparison();
}
public int getLSB(){
String x = fileChooser1.getSelectedFile().getAbsolutePath();
x = x.substring(x.length() - 10, x.length() - 9);
return Integer.parseInt(x);
}
when some criteria are met. My problem is that, when I try to access getLSB by using gui.getLSB()
public class DataComparison {
public static SteganographyGUI gui;
...
public DataComparison(){
lsb = gui.getLSB();
}
public static void main(String[] args) {
gui = new SteganographyGUI();
gui.setVisible(true);
}
Error appears - Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
How can I fix this?