Core Java Interview Questions For Selenium WebDriver - Part 3

Part 3

11 : Why primary method is static?

Answer : As nosotros know, We tin travel access static materials without creating object of class. Because of static keyword amongst primary method, Java virtual machine tin travel straight telephone telephone it without creating object of class. This agency it volition supply variety of source to showtime execution of program.

12 : What is method overloading?

Answer : Method overloading is might to exercise multiple methods amongst same inwards same shape but amongst dissimilar signatures (different input parameters too types). Method names volition endure same but parameters volition endure dissimilar for all overloaded methods.

13 : What is constructor overloading?

Answer : Same every bit method overloading, Single shape tin travel convey multiple constructors amongst same mention every bit shape mention but all convey dissimilar signatures (different input parameters too types) is called constructor overloading. READ MORE virtually constructor overloading.

14 : Can nosotros override static methods?

Answer : We tin travel declare static method amongst same signature inwards subclass but it volition non bear every bit overridden method. So response is No.. We tin travel non override static methods every bit they are business office of  class non object.. You tin travel override static methods but output volition endure dissimilar than the expected.

15 : How to opposite string inwards java?

Answer : StringBuffer shape has a method called reverse(). We tin travel role it to opposite the string.
Example :

populace static void main(String[] args) {
// buffer string using StringBuffer class.
StringBuffer a = novel StringBuffer("I similar coffee real much.");
// role reverse() method to opposite string
System.out.println(a.reverse());
}


More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post