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 = "[email protected]";
String username = email .substring(email .indexOf("@") + 1);
System.out.println(username);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *