Reputation: 11
I wrote two Methods File name Login.java:
public int multiply(int x, int y) {
return x * y;
}
public void news(){
selenium.open("http://10.0.0.33:8080/Olio/");
}
I call these from a different class named Bank.java
public void testBank() throws Exception {
Login lg = new Login();
System.out.println(lg.multiply(4,8));
lg.news();
Thread.sleep(3000);
}
The first method works, I get 32.
The second method throws a java.lang.NullPointerExpression
.
Why is this happening?
Upvotes: 1
Views: 1004
Reputation: 4707
I am guessing that selenium
is null
. Have you instantiated it anywhere ?
Upvotes: 3