Search code examples
modulobluej

Why does BlueJ say that modulo isn't a statement?


For school I have to make a little program that makes Ticket Id's. One task says: "The ticket ID is the age modulo the length of the first name + the length of the last name. I've tried this:

TicketID = firstname + lastname;

TicketID.length() % age;

I get the error that the % is not a statement.

If you could help me that would be amazing.


Solution

  • You need to assign the result of % to some other variable

    TicketID = firstname + lastname;
    
    (here) = TicketID.length() % age;