Java Interview Questions For Selenium WebDriver - Part 1

PART 1

1 : What is object in java?

Answer : Object Is an Instance of class and it has its own state and behavior. In real world we can say, Dog is object of Animal class which have different state like breed, color, name, hungry, etc and behavior  like wagging tail, fetching, barking etc.

2 : What is class?

Answer : A class is the blueprint or we can say template from which individual objects are created.

3 : What is constructor?

Answer : Constructor is a code block just like a method which is used to initialize the state of an object. It will be invoked at the time of object creation to construct the value for object. VIEW DETAIL

4 : What is default constructor?

Answer : If there is not any constructor in class then java compiler creates default constructor. It is no argument constructor which initializes any uninitialized fields to their default values.

5 : Constructor returns any value?

Answer : Yes. It will return instance of current class (However we can not use return type with constructor).

5 comments:

  1. Great stuff...Thanks for the valuable links.

    ReplyDelete
  2. can u please update other topics like frameworks,pom,apache poi,all other topics .it helpful for all who is searching for jobs in selenium

    ReplyDelete
  3. thanks for starting with very basics and explaining in the simple manner. Better to add few technical details as well :)

    ReplyDelete
  4. very good questions for interview

    ReplyDelete
  5. Dummy stuff...It could be useful only for the academic students not for the interviews.
    Try to say in realtime way.
    Ex: Object is an instance of a class where the methods that are defined in any class can be called by using the Object

    ReplyDelete