In Java Client 7 unable to use Presseskey

I want to enter a text in the input field through keyboard. By entering the text through keyboard only I get the name suggestions. Using sendkeys not helping, tried entering text one by one still no help.
On using PressesKey getting error: "java.lang.ClassCastException: io.appium.java_client.AppiumDriver cannot be cast to"

code : ((PressesKey) driver).pressKey(new KeyEvent(AndroidKey.Q));

Android OS : 7.0
Appium version: 1.10.0
Java Client : 7.0