Hi Pritha, you can use this code snippet to open Firefox window in Incognito (private) mode using Selenium Webdriver:
System.setProperty("webdriver.gecko.driver","C:\\Users\\Abha_Rathour\\Downloads\\ExtractedFiles\\geckodriver-v0.24.0-win64\\geckodriver.exe" );
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("browser.privatebrowsing.autostart", true);
WebDriver driver= new FirefoxDriver(capabilities);
driver.navigate().to("https://www.google.com");