Advanced Java Interview Questions Guru99

Q63) What are the two environment variables that must be set in order to run any Java programs?

Ans: Java programs can be executed in a machine only once following two environment variables have been properly set:

Q46) There are two classes named classA and classB. Both classes are in the same package. Can a private member of classA can be accessed by an object of classB?

Ans: Private members of a class aren’t accessible outside the scope of that class and any other class even in the same package can’t access them.

59)  In Selenium IDE how you can generate random numbers and dates for test data?

In Selenium IDE you can generate random numbers by using Java Script

Q54) What’s difference between Stack and Queue?

Ans: Stack and Queue both are used as placeholder for a collection of data. The primary difference between a stack and a queue is that stack is based on Last in First out (LIFO) principle while a queue is based on FIFO (First In First Out) principle.

32) Can we use Selenium grid for performance testing?

Yes. But not as effectively as a dedicated Performance Testing tool like Loadrunner.

Q31) Is String a data type in java?

Ans: String is not a primitive data type in java. When a string is created in java, it’s actually an object of Java.Lang.String class that gets created. After creation of this string object, all built-in methods of String class can be used on the string object.

89) Mention why to choose Python over Java in Selenium?

Few points that favor Python over Java to use with Selenium is,

  • Java programs tend to run slower compared to Python programs.
  • Java uses traditional braces to start and ends blocks, while Python uses indentation.
  • Java employs static typing, while Python is dynamically typed.
  • Python is simpler and more compact compared to Java.
  • Q65) Can a class in Java be inherited from more than one class?

    Ans: In Java, a class can be derived from only one class and not from multiple classes. Multiple inheritances is not supported by Java.

    31) What are the Spring Boot properties?

    Spring Boot offers various properties which can be specified inside our project’s application.properties file. It helps you to set values like a server-port number, database connection configuration, etc.

    64) Explain map. entry In Map

    Map.entry is a Java interface of java.util. It has a nested interface in Map. This interface must be qualified by the name of class or interface, which it is a member. Therefore it is qualified as a Map. Entry. It represents a key and value pair that can forms element of a Map.

    This method returns a view of the collection. For example, consider cityMap as a map. The developer can use entrySet() to get the set view of map having an element Map.Entry. Programmer can also use getKey() and getValue() of the Map.Entry to get the pair of key and value of the map.

    Q61) What will be the output of following piece of code?

    Ans: In this case postfix ++ operator is used which first returns the value and then increments. Hence it’s output will be 4.

    53) Explain Docker in Spring Boot.

    It is a tool designed to create, deploy, and run a project by using containers.

    The ELK Stack is made of three open-source products: 1) Elasticsearch, 2) Logstash, and 3) Kibana.

  • Elasticsearch: It is a NoSQL database which is based on the open-source search engine called Lucene.
  • Logstash: It is a data processing pipeline tool which accepts inputs from sources, performs different transformations, and exports the data to targets.
  • Kibana: Kibana helps users to visualize data with graphs and chart in Elasticsearch.
  • Top 10 JAVA Interview Questions and Answers

    Related Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *