I have a class like this one:
class Tickets{
Data data;
class Data{
String departure;
}
public String getDeparture(){
return data.departure;
}
}
When I try something like this:
Tickets tickets=new Tickets();
if (tickets.getDeparture!=null)
I get nullpointerexception on this check. Why is that so? How can I avoid it? What to do instead? Thanks for help.