just wondering if anyone could explain this...
if(loginF.equals("root") && passwordF.equals("root")); ---> if this semicolon is here, my program works.. but i can't have an else statement
if i take out this semicolon, the code within the if statement don't execute.. but i can then have an else statement ... no exceptions though
this is the entire method
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == submitB)
{
try
{
//if(loginF.equals("root") && passwordF.equals("root"));
if(loginF.getText()=="root" && passwordF.getText() == "root");
{
mb = new MenuBar(this);
mb.setBackground(java.awt.Color.white);
this.setJMenuBar(mb);
this.validate();
this.repaint();
setBounds(400, 400, 600, 500);
setVisible(true);
}
/*
else //not allowed because of the ; above
{
JOptionPane.showMessageDialog(null, "wrong password!");
}
*/
}// end try
catch(Exception x)
{
System.out.println(x.toString());
}
/*
else
{
JOptionPane.showMessageDialog(null, "wrong password");
}
*/
}// end button if
}
it is really strange to me.... please help.