### Source code for GetEMailHostExample.java:

>     public class GetEMailHostExample
>     {
>     	public String getEMailHost(String emailAddr)
>     	{
>     		int index;
>     		int length = emailAddr.length();
>     		for(index = 0; index < length; index++)
>     		{
>     			if(emailAddr.charAt(index) == '@')
>     			{
>     				return(emailAddr.substring(index +1));
>     			}
>     		}
>     		return(null);
>     	}

>     	public static void main(String args[])
>     	{
>     		System.out.println("GetEMailHostExample");
>     		GetEMailHostExample ex = new GetEMailHostExample();
>     		String email = "java.joe@sun.com";
>     		String retString = ex.getEMailHost(email);
>     		System.out.println("Email host of " + email + ": " + retString);
>     		email = "com!sun!java.joe";
>     		retString = ex.getEMailHost(email);
>     		System.out.println("Email host of " + email + ": " + retString);
>     	}
>     }

### Output from GetEMailHostExample.java:

    GetEMailHostExample
    Email host of java.joe@sun.com: sun.com
    Email host of com!sun!java.joe: null

--- Output Ends ---

#### NOTE:

You are reading previously generated output. You are not currently running the GetEMailHostExample application at the momement. You need to compile and run the source code first.

#### To run this program:

`
- javac GetEMailHostExample.java
- java GetEMailHostExample
`

Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR