Hi,in this post we’re going to continue discussing the previous post on Wandisco Fresher Interview Questions with Answers. Let us explore the questions briefly;

Wandisco Fresher Interview Questions with Answers

6. Explain the features of Java.

1)Simple:
Java is very easy to learn, and its syntax is simple, clean and easy to understand.
2)Object-oriented:
Everything in Java is an object. Object-oriented means we organize our software as a combination of different types of objects that incorporates both data and behavior.
3)Platform Independent:
Java code is compiled by the compiler and converted into bytecode. This bytecode (platform-independent code) can be run on multiple platforms, i.e., Write Once and Run Anywhere(WORA).
4)Secured:
Java is secured because there is no explicit pointer. And, Java Programs run inside a virtual machine sandbox.
5)Robust:
Java is strongly typed, which allows extensive compile-time error checking. It does not support memory pointers, which eliminates the possibility of overwriting memory and corrupting data.
6)Architecture-neutral:
Java is architecture neutral because there are no application dependent features.
7)Portable:
Java is portable because it facilitates you to carry the Java bytecode to any platform
8)Multi-threaded:
Java supports multiple threads of execution, including a set of synchronization primitives.
9)Dynamic:
Java is a dynamic language. It supports dynamic loading of classes. It also supports functions from its native languages, i.e., C and C++.
10)Distributed:
Java is distributed because it facilitates users to create distributed applications in Java. RMI and EJB are used for creating distributed applications.JAVA

7. Write a program in java(any oops concept) and explain the program.

SAMPLE CODE ON OBJECTS AND CLASSES:
// Class Declaration

public class Dog
{
// Instance Variables
String name;
String breed;
int age;
String color;

// Constructor Declaration of Class
public Dog(String name, String breed,
int age, String color)
{
this.name = name;
this.breed = breed;
this.age = age;
this.color = color;
}

// method 1
public String getName()
{
return name;
}

// method 2
public String getBreed()
{
return breed;
}

// method 3
public int getAge()
{
return age;
}

// method 4
public String getColor()
{
return color;
}

@Override
public String toString()
{
return(“Hi my name is “+ this.getName()+
“.\nMy breed,age and color are ” +
this.getBreed()+”,” + this.getAge()+
“,”+ this.getColor());
}

public static void main(String[] args)
{
Dog tuffy = new Dog(“tuffy”,”papillon”, 5, “white”);
System.out.println(tuffy.toString());
}
}
SAMPLE OUTPUT:

Hi my name is tuffy.
My breed,age and color are papillon,5,white

EXPLANATION OF EXECUTION:
The constructor in the Dog class takes four arguments. The following statement provides “tuffy”,”papillon”,5,”white” as values for those arguments:
Dog tuffy = new Dog(“tuffy”,”papillon”,5, “white”);

8. What is method overloading?

 Method Overloading is a feature that allows a class to have more than one method having the same name, if their argument lists are different.
 It is similar to constructor overloading in Java.
 Three ways to overload a method:
In order to overload a method, the argument lists of the methods must differ in either in;
1. Number of parameters.
Eg: add(int, int)
        add(int, int, int)
2. Data type of parameters.
Eg: add(int, int)
       add(int, float)
3. Sequence of Data type of parameters.
Eg: add(int, float)
       add(float, int)

9. What is an interface in Java?

=>Interfaces specify what a class must do and not how.
=>An interface can have methods and variables, but the methods declared in interface are by default abstract.
=>To declare an interface, use interface keyword.
=>SYNTAX:
interface <interface_name> {
// declare constant fields
// declare methods that abstract
// by default.
}INTERFACE

10. Webdriver commands in java.

We can generally classify Webdriver commands as Browser commands, Get commands, Navigation commands, Webelement commands, Action commands and Result commands.
Top 7 Selenium Commands:
1.get() methods
2.Locating links by linkText() and partialLinkText()
3.Selecting multiple items in a drop dropdown
4.Submitting a form
5.Handling iframes
6.close() and quit() methods
7.Exception HandlingSEL

11. What is test scenario?

=>A Test Scenario is any functionality that can be tested.
=>It is also called Test Condition or Test Possibility.
=>As a tester, you may put yourself in the end user’s shoes and figure out the real-world scenarios.test

References:
https://www.javatpoint.com/features-of-java
https://www.geeksforgeeks.org/classes-objects-java/
https://beginnersbook.com/2013/05/method-overloading/
https://www.guru99.com/test-scenario.html
https://www.softwaretestinghelp.com/selenium-webdriver-commands-selenium-tutorial-17/