More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. There is no concept of de referencing with primitive types and hence they are implicitly immutable. Having wrapper classes as mutable offers disadvantages compared to primitive types. Wrapper classes being immutable offer similar advantage as primitive types.It actually overshadows the disadvantage wrapper class could have if they are immutable.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Immutable objects are thread-safe so you will not have any synchronization issues.Immutable objects are good for Map keys and Set elements, since these typically do not change once created.Immutability makes it easier to write, use and reason about the code (class invariant is established once and then unchanged)Immutability makes it easier to parallelize your program as there are no conflicts among objects.The internal state of your program will be consistent even if you have exceptions.References to immutable objects can be cached as they are not going to change.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Here are the differences between Agile and Waterfall Methodology:
The software development process is divided into different phases in the Waterfall model while Agile methodology segregates the project development lifecycle into sprints
Waterfall is a structured software development methodology, and often times can be quite rigid, whereas the Agile methodology is known for its flexibility
According to the Waterfall model, software development is to be completed as one single project, which is then divided into different phases, with each phase appearing only once during the SDLC. However, the Agile methodology can be considered as a collection of many different projects, which are nothing but the iterations of the different phases focusing on improving the overall software quality with feedback from users or the QA team
If you want to use the Waterfall model for software development, then you have to be clear with all the development requirements beforehand as there is no scope of changing the requirements once the project development starts. The Agile methodology, on the other hand, is quite flexible, and allows for changes to be made in the project development requirements even after the initial planning has been completed
All the project development phases such as designing, development, testing, etc. are completed once in the Waterfall model while as part of the Agile methodology, they follow an iterative development approach.
As a result, planning, development, prototyping and other software development phases can appear more than once during the entire SDLC One of the major differences between Agile and Waterfall development methodology is their individual approach towards quality and testing.
In the Waterfall model, the Testing phase comes after the Build phase, but, in the Agile methodology, testing is typically performed concurrently with programming or at least in the same iteration as programming
While Waterfall methodology is an internal process and does not require the participation of customers, the Agile software development approach focuses on customer satisfaction and thus, involves the participation of customers throughout the development phase
The Waterfall model can be regarded as a stringently sequential process, however, the Agile methodology is a highly collaborative software development process, thereby leading to better team input and faster problem solving
The Waterfall model is best suited for projects which have clearly defined requirements and in which change is not expected at all, while Agile development supports a process in which the requirements are expected to change and evolve. Thus, if you are planning to develop a software that would require frequent overhauls and has to keep up with the technology landscape and customer requirements, Agile is the best approach to follow
The Waterfall model exhibits a project mindset and lays its focus strictly on the completion of project development, while Agile introduces a product mindset that focuses on ensuring that the developed product satisfies its end customers, and changes itself as the requisites of customers change
Help us improve. Please let us know the company, where you were asked this question :
Q1940. Suppose we have a string "Java is object oriented language" and we have to reverse every alternate word in string. How would we do that using Java program.
Ans. For JPS we can use modelAttribute and ModelAndView object to share data between JPS and Controller. In case of Angular JS, the angular js always get data in form of JSON and it can be accessed by REST WS. So the angular js share data with controller in the form of JSON.
Help us improve. Please let us know the company, where you were asked this question :
Ans. public class BinarySearchTree {
//Represent the node of binary tree
public static class Node {
int data;
Node left;
Node right;
public Node(int data) {
//Assign data to the new node, set left and right children to null
this.data = data;
this.left = null;
this.right = null;
}
}
//Represent the root of binary tree
public Node root;
public BinarySearchTree() {
root = null;
}
//factorial() will calculate the factorial of given number
public int factorial(int num) {
int fact = 1;
if (num == 0) return 1;
else {
while (num > 1) {
fact = fact * num;
num--;
}
return fact;
}
}
//numOfBST() will calculate the total number of possible BST by calculating Catalan Number for given key
public int numOfBST(int key) {
int catalanNumber = factorial(2 * key) / (factorial(key 1) * factorial(key));
return catalanNumber;
}
public static void main(String[] args) {
BinarySearchTree bt = new BinarySearchTree();
//Display total number of possible binary search tree with key 5
System.out.println("Total number of possible Binary Search Trees with given key: "
bt.numOfBST(5));
}
}
Help us improve. Please let us know the company, where you were asked this question :
Ans. The term monkey patch only refers to dynamic modifications of a class or module at runtime, motivated by the intent to patch existing third-party code as a workaround to a bug or feature which does not act as desired.
Help us improve. Please let us know the company, where you were asked this question :