How to Login and Logout in Gmail

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Openbrowser
{
public static void main(String args[]) throws InterruptedException
{
WebDriver driver=new FirefoxDriver();

driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);


driver.get("http://gmail.com/");

driver.findElement(By.id("Email")).sendKeys("");

driver.findElement(By.id("Passwd")).sendKeys("");

driver.findElement(By.id("signIn")).click();

Thread.sleep(4000);

driver.findElement(By.xpath("//*@id='gb']/div[1]/div[1]/div[2]/div[5]/div[1]/a/span")).click();

driver.findElement(By.id("gb_71")).click();

}
}