Hey Rajesh, you can check this code snippet to understand desired capabilities methods on a webdriver:
public class Desired_Capability_Methods {
public static void main(String[] args) throws IOException {
System.setProperty("webdriver.gecko.driver", "D:\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.com/");
// Created DesiredCapabilities object
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "your Device Name");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability(CapabilityType.VERSION, "5.1");
capabilities.setCapability("platformName", "Android");
}
}