Essentially, driver.getTitle(); function can be used to get the title of a page. So Aniket's code will also work, but there would be complications. So i'll just explain it a little better (hopefully :P).
System.setProperty("webdriver.gecko.driver", "D:files\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://www.edureka.co");
String title = driver.getTitle();
System.out.println("Title is: ", +title);