I've never used the ?
operator before and I'm trying to figure out how it works.
I have been reading countless pages and decided to try for myself.
I have the following statement:
getSelection().equalsIgnoreCase("Måned") ? calendarView.currentlyViewing.set(Calendar.Year) : showPopup();
As far as I can understand, if the left hand side (boolean) is true it will set my calendarView.to year and if not (getSelection is not equal to måned) it will call the method showPopup()
.
But when I type this into Eclipse I get a syntax error.
What am I doing wrong?