My answer to your to question in Launch Firefox and Wait until it is Closed is also applicable here. However you need to add the import below
import org.openqa.selenium.chrome.ChromeDriver;
and change the following code from
driver = new FirefoxDriver();
to
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
driver = new ChromeDriver();
You also need to a download a separate chrome driver file (chromedriver.exe). A link is available in the selenium website. You need to copy the file in appropriate folder.