Post a New Question

Computer Science Java

posted by .

Alright I have these strings

String domain1 = ". com";
String domain2 = ". edu";
String domain3 = ". org";

I want to make sure that when the user puts in their username (their email) that the domain will be the last four characters. How do I get this to happen? Thank you

  • Computer Science Java -

    if (s.matches("\\.(com|edu|org)$")) {...} else {...}

Answer This Question

First Name:
School Subject:

Related Questions

More Related Questions

Post a New Question