SEARCH
You are in browse mode. You must login to use MEMORY

   Log in to start

level: Level 1

Questions and Answers List

level questions: Level 1

QuestionAnswer
What is the current version of Java I am using?I am using Java 8
Why am I using Java 8?My recent company’s framework used Java 8
What is the difference between JRE + JDK?a. JRE= Java runtime environment (if you just want to run the files/program, java library) holds the JVM b. JDK= is the entire package (JRE, compiler(converts from java to binary code, JVM) c. JVM= takes the byte code and convert it to machine(window, unix, mac, mobile) code (based on
Difference between == and =?== comparison = assignment
Difference between == sign and equals method== is an operator that compares the reference . .equal is a method that compares the content *Can compare strings but only literally. Use .equals to compare strings
What is method?A collection of statements grouped together that perform an action.
What kinds of methods are there?Methods with and without return type
What is the main method?Main methods are used to execute the code. It’s the first JVM call.
Do we need a main method?No
Explain public static void main (String[] args)?Public is an access modifier. Static it’s a non-access modifier that means your method belongs to the class and can be called by the class name. Void means there is no return type. Main is the name of the method. (an array of strings)
Default + protected?Protected only has access inside its package, can be accessed through inheritance. Default only has access to its own package
How do you use the access modifiers?You use the modifiers based on your framework, in my current framework I developed some utility classes such as excel(private) to restrict and my constants & webelements(public) to be accessed from my entire framework.
What is an instance variable and how do you use it?Instance variables are declared in the class but outside the method. I used them in my coding for find elements in my page object model. We stored elements in the form of instance variables.
How can we access variables without creating an instance?We can create the variable with static.
How did I use static in the framework?We used them in our common methods where I kept my web browser for easy accessibility. I also used them in my constatants to establish our screenshots, etc..
What is a constructor?A block of code that is executed when an object is created. The constructor is used to initialize the object. We used it in my framework in the page initialize.
What types of constructors do we have?With parameters, without parameters and default constructor.
Constructor vs method?A constructor should initialize the object, method perform actions on the objects. *We can overload but not override. We can change type and/or number of parameters or to overload. We can use all access modifiers with a constructor. No non-access modifiers can be added. I created a constructor when I created the page object model when I was initializng the variables all at once. Construtors do not participate in inheritance so It can not be over ridden.
Super vs super()?super is used to access the methods from the parent class with the same name to the super() we are calling the constructor with the same parent class .
This vs this()?This is used to access current object of local and instance variables. This() to access one constructor from another where both constructors belong to the same class
Difference between abstract class and interface?Interface is the blueprint that can be used to implement a class, no constructors, use implement, also only variables that a final. Abstract can have all defined and undefined methods and different access modifiers, using extend, can have instance or static variables.
Can we create an object of abstract or interface?NO can not create an object of unimplemented methods
Do we use abstract classes in interfaces?Yes. We use them but not develop it. We used existing ones
OOPS concept?Javas Object Oriented Programming Abstraction, Polymorphiasm, inheritance, encapsulation.
Is java 100% object oriented?No because we have primitiave data types
Inheritance?Accquiring variables, methods from one class to the next, code reusability, getting all the features from the parent class(es). Single(class to class), hiecaral(1 parent 2+ kids), multilevel(grand kids).
Which inheritance is not included in the concept of classes?Multiple and hybrid
Why does java not allow multiple inheritance?There might be a confilict, use the interface method to solve this. We used multilevel inheritance in our frame work with our baseclass (webdriver) ->page initializer(page object from page object model) -> common methods (methods to use on web driver)
Polymorphism 2 types?static/compiletime overloading or dynamic/runtime overriding
What is Overriding ?Method signature (parameters and name) + return type must be the same (access modifiers can be lower but not more) can’t override final, static, private, constructor
Overloading?Method signature must be different (parameters and name)
Have you used Static binding?Yes used them with overloading and made it easier to use and prevent code redundancy
How have you used Overriding?We used them in our framework when using the webdriver (chrome, safari etc..)
Can we overload the main method?Yes we can overload, we will just have to change the signature. As a tester we don’t really use the main method. We can not override because the method needs to be inherited.
When there is a static method in parent class and child class?Called method hiding
Can we achieve 100% abstraction?Yes using interface and abstract class.
Encapsulation?It is accessing private methods to access public methods.
Primatives?There are 8 byte, long, short, float, integer, char, Boolean, double
Wrapper Class?Taking primitive types and making them into objects. We use them when we are using our collection framework