• Slider Banner

    Prepare for

    Technical Interview

    Over .1 Million+ Interview Questions for different profiles

    Read More
  • Slider Banner

    Join the

    Programming World

    Learn about top programming languages, tools and frameworks.

    Read More
  • Slider Banner

    Prepare with

    Certification MCQ

    Practice for certification from 1000+ multiple choice questions.

    Read More

What is multiple inheritance? Is it supported by Java?

If a child class inherits the property from multiple classes its known as multiple inheritance. For Example: Class C extends B, A. Java does not allow to extend multiple classes.

The problem with multiple inheritance is that if multiple parent classes have the same method name, then at runtime it becomes difficult for the compiler to decide which method to execute from the child class.

Therefore, Java doesn’t support multiple inheritance. The problem is commonly referred to as Diamond Problem.

Can you override a private or static method in Java?

You cannot override a private or static method in Java. If you create a similar method with the same return type and same method arguments in child class then it will hide the superclass method; this is known as method hiding.

Similarly, you cannot override a private method in subclass because it’s not accessible there. What you can do is create another private method with the same name in the child class. 

What are the different types of inheritance in Java?

Java supports four types of inheritance which are:

  1. Single Inheritance: In single inheritance, one class inherits the properties of another i.e there will be only one parent as well as one child class. For example Class B extends A.
  2. Multilevel Inheritance: When a class is derived from a class which is also derived from another class, i.e. a class  having more than one parent class but at different levels, such type of inheritance is called Multilevel Inheritance. For Example: Class B extends A and then Class C extends A.
  3. Hierarchical Inheritance: When a class has more than one child classes (subclasses) or in other words, more than one child classes have the same parent class, then such kind of inheritance is known as hierarchical. For Example: Class B extends A. Class C extends A.
  4. Hybrid Inheritance: Hybrid inheritance is a combination of two or more types of inheritance.

What will be the output of below Java code?

Example Code: 

public class A
{
    public static void main(String[] args)
    {
        String x = null;
        m2(x);
        
        System.out.println(x);
    }
    static void m2(String s)
    {
        s = "Vinay";
    }
}

Output: null

What are the strategies that can be used to grow business through Instagram?

1. Create an Instagram Account: This is the first step to start with creating Instagram account . Which helps in driving people to landing page so that you get email id or contact details and can reach to them.

2. Define Target Audience: To define the target audience is the most important step for any social platform. It will help to reach only the defined audience. So as to compel and happy to buy your product with in the defined periphery.


3. Photo Ads: Some other steps so as to make more engagement to the page and to drive the audience. Such as creating simple Photo ads as to promote through photo of your product.

4. Video Ads:  60 secs long video also can be created may  be in landscape or square mode. This is super powerful as user love videos to interact with.

5. Carousel Ads: This is kind of creating a bunch of photos in sequence. Like to show more than one product photos or if to show one product it can be shown with different features of that product.

6. Stories Ads:  Creating videos on instagram stories. Then people can follow your brand. Lot of users are going on instagram stories directly in spite going to timelines. We can connect with 250+ million people using stories daily

While using click command in Selenium can you use screen coordinate?

To click on specific part of element, you would need to use clickAT command.  ClickAt command accepts element locator and x, y co-ordinates as arguments - clickAt (locator, cordString).

DefaultSelenium.ClickAt Method

It clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call waitForPageToLoad.

What is the difference between type keys and type commands in Selenium?

TypeKeys() will trigger JavaScript event in most of the cases whereas .type() won't. Type key populates the value attribute using JavaScript whereas .typekeys() emulates like actual user typing.

DefaultSeleniumTypeKeys Method  

Simulates keystroke events on the specified element, as though you typed the value key-by-key.

This is a convenience method for calling keyDown, keyUp, keyPress for every character in the specified string; this is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.

Unlike the simple "type" command, which forces the specified value into the page directly, this command may or may not have any visible effect, even in cases where typing keys would normally have a visible effect. For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in the field.

In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to send the keystroke events corresponding to what you just typed.

How will you find an element using Selenium?

In Selenium every object or control in a web page is referred as an elements, there are different locators to find an element in a web page they are:

  • ID
  • Name
  • Tag
  • Attribute
  • CSS
  • Linktext
  • PartialLink Text
  • Xpath etc

You can use findElement() to find single element and findElements() method to find multiple elements in Selenium.

Mention what is Selenium 3.0?

Selenium 3.0 is the latest version of Selenium. Here are few new features added to Selenium 3.0:

  • Minimum Java version is now 8+
  • It will support for Firefox Via Mozilla’s geckodriver
  • Support for Edge is provided by MS
  • It now supports Safari on MacOS via Apple's own Safari driver
Subscribe to