You can use locators to find the textbox and then search for a keyword you like.
1. Open Google and right click to inspect element. You can use F12 also to inspect elements.

2. Go to the searchbox and inspect the web element you can use for your purpose.

You can see that there is a name field, I will use it for finding the search box.
Here is the code that I am using:
System.setProperty("webdriver.chrome.driver","C:\\Users\\Downloads\\chromedriver.exe");
WebDriver wd = new ChromeDriver();//create an instance for webdriver named wd of type chrome
wd.get("https://www.google.com");//open google
WebElement elem = wd.findElement(By.name("q"));//finding the web element using name locator
elem.sendKeys(new String[]{"selenium is fun"});
elem.submit();
Output:
