Write a program to read the email ID and extract the username in Java
import java.util.regex.*; import java.io.*; public class Test { public static void main(String[]args) { String email = "user@example.com"; String username = email .substring(email .indexOf("@") + 1); System.out.println(username); } }