Java Interview question Set-1:
SET-01 1-10
Java Interview question Set-2:
Java Interview question Set-3:
31. How to create a folder with the current timestamp in java?
32. How to insert ABCD in the 3rd index of string abcdefgh ?
StringBuilder sb1 = new StringBuilder("abcdefgh");
// StringBuilder insert(int indext, String whatToInsert)
System.out.println(sb1.insert(3, "ABCD"));// abcABCDdefgh
33. What are superclass and subclass in Java?
Superclass and Subclass
•A superclass is also referred to as a parent class or a base class.
•A subclass is a child class, an extended class, or a derived class.
•A subclass inherits accessible data fields and methods from its superclass and may also add new data fields and methods.
•Inheritance is a relationship. E.g.:- A pineapple is a fruit
34. How to Declare, Create, Initialize and loop around Array?
35. What is an Array of Objects?
Two ways to initialize the array of objects:
- By using the constructors
- By using a separate member method
- By using the constructors is the most used one and we will try to explore the same
Person[] persons = new Person[3];
// to assign objects we would need to create, Initializing the element of the array
persons[1] = new Person(2, "test2");
persons[2] = new Person(3, "test3");
int id;
String name;
36. How to generate a random string for data usage in Project?
Click Here For Answer with Code
37. What is Finally in Java?
- The code in the finally block is executed whether an exception occurs in the try block or whether it is caught.
- The finally block always executes when the try block exits.
- Java finally block follows try or catch block.
- Finally is also a reserved keyword in java.
- The syntax for the finally clause:
try { Statements;
}
catch (TheException ex) {
}
finally { finalstatements;
}
38. What is MAP and how we traverse through Map?
Click Here For Answer with Code
39. What will be the output for the below Increment/Decrement Operators?
int j = ++i;
System.out.println(i + " " + j);
Abswer: OUTPUT: 26 26
Question: int i = 25;
int j = i++;// i value(25) is assigned to j, then incremented to 26
System.out.println(i + " " + j);
Answer: OUTPUT: 26 25
40. How to define SINGLETON in java?
Click Here For Answer with Code
41. How to integrate Maven project with Jenkins?
42. How to install JDK and set Java Home path in Windows and MacOs ?
Java Interview question Set-1:
SET-01 1-10
Java Interview question Set-2:
Java Interview question Set-3:
*************************************************
API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign
Java Related Interview Question Set
https://automationreinvented.blogspot.com/search/label/Java
GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT
Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions
No comments:
Post a Comment