Interview Questions Of Core Java For Selenium WebDriver - Part 2

Part 2

Core java interview questions for selenium automation testing

6 : What is the difference between static and not static variable?

Answer : Main differences are as bellow.
  • Static variables are preceded by static keyword. For non-static variable, there is not any preceding keyword.
  • Memory is allocated for static variables at the time of class loading. Memory is allocated to non- static variables whenever an object is created.
  • Memory is allocated only once to static variables on class loading. Memory is allocated multiple time whenever a new object is created to non-static variables.
  • Static variable example : Collage name of students, Company name of employees..
READ MORE about static and non-static stuff.

7 : What is the difference between static and not static(Instance) method?

Answer : Difference between static and non static method is as bellow.
  • Method declared with static keyword is static method. If Method declared without static keyword then it is instance method.
  • No need of object to call static methods. Object needed to call instance method.
  • Can not access non static stuff inside static methods directly. Opposite to it, We can access static and non static stuff directly inside instance method.
READ MORE detail on static and non-static stuff.

8 : What is inheritance in java?

Answer : In Java, Inheritance provides mechanism using which one object of child class can acquire  all the properties and behaviors of parent object. It will crate IS-A relationship. Main usage of inheritance in java is for code re-usability and  method overriding to achieve run-time polymorphism. VIEW MORE detail on inheritance.

9 : Multiple inheritance is supported in java on class level? If No.. Why?

Answer : No.. Multiple inheritance is not supported in java in case of class to simplify the language and reduce the complexity.

10 : What is method overriding in java?

Answer : Method overriding is a feature which allows a child class or sub class to provide a specific implementation of a method which is already provided by one of its parent classes or super class. It is used for runtime polymorphism. You can read more about method overriding on THIS POST.

core java interview questions for automation testingcore java interview questions for selenium automation testingcore java interview questions for selenium testerscore java interview questions for automation testersinterview questions on core java for selenium testerscore java interview questions for experienced selenium testerscore java for selenium interview questionscore java interview questions and answers for selenium testers

1 comment:

  1. Good one.. Such post are short and easy to finish.. thanks

    ReplyDelete