This tutorial extends Spring MVC form submission tutorial step by step. This tutorial gets rid of web.xml and applicationContext.xml files.
pom.xml changes
Step 1: Add “JSTL” (i.e. JSP Standard Tag Library ) jar dependency,
…
This tutorial extends Spring MVC form submission tutorial step by step. This tutorial gets rid of web.xml and applicationContext.xml files.
pom.xml changes
Step 1: Add “JSTL” (i.e. JSP Standard Tag Library ) jar dependency,
…
Q. Complete the method “isValidBST(Node root)” which takes a “Tree node” as an input to evaluate if the input is a valid BST (i.e. Binary Search Tree)?
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
public class BinarySearchTree { public static boolean isValidBST(Node root) { throw new RuntimeException("To be completed"); } public static void main(String[] args) { Node n4 = new Node(2, null, null); Node n5 = new Node(4, null, null); Node n6 = new Node(6, null, null); Node n7 = new Node(8, null, null); Node n1 = new Node(3, n4, n5); Node n3 = new Node(7, n6, n7); //root node Node n2 = new Node(5, n1, n3); System.out.println(isValidBST(n2)); } } class Node { public int value; public Node left, right; public Node(int value, Node left, Node right) { this.value = value; this.left = left; this.right = right; } } |
A. Detailed answers on recursive & … Read more ›...
Q1. What are the different binary tree traversal mechanisms? A1. Traversing a tree means visiting all the nodes of a tree in order. Many different binary tree algorithms involve traversals. For example, if you wish to count the number of employees in an organizational chart you must visit each node....
Q1. Have you seen job advertisements requiring Java candidates to work in real-time or high volume transaction processing systems? A1. If you are applying for such jobs, you can be quizzed on Big O notation. Here are some basics to brush up on. … Read more ›...
Q1. What is a .git folder? A1. Like .SVN folder for subversion holding the metat data, .git folder holds the Git meta data like remote repository, branch names, etc. If you do
|
1 |
cat head |
it shows that you are on the branch “ … Read more ›...
Q6. What is wring with this code?
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
public class WhatIsWrong { public static void main(String args[]) { float sum = 0; while (sum != 1.0) { sum += 0.1; } System.out.print("The sum is: "+sum); } } |
A6. Infinite loop at due to sum != 1.0. Using floating point variables like float or double in loops to compare for equality can lead to infinite loops. Comparing for “” or “
…
Q1. Does Spring dependency injection happen during compile time or runtime? A1. Runtime during creating an object. Q2. What is the difference between prototype scope and singleton scope? Which one is the default? A2.Singleton means single bean instance per IoC container, … Read more ›...
LazyInitializationException is thrown when an object becomes detached, and if you try to access associated (i.e. proxied) object(s) of a detached object.
Q. What is a detached object in Hibernate?
When you close an individual Hibernate Session, the persistent objects you are working with are detached.
…
Q1. When is an object needs to implement the Comparable interface? a) When adding it to a HashSet. b) When adding it to a TreeSet. c) When adding it to a LinkedHashSet. … Read more ›...
JSF or JavaScript based frameworks like angularjs, ember, etc are more popular than JSPs for web developemnt. Q1. What is a JSP? How does it differ from a Servlet? A1. JSP stands for Java Server Pages. JSP technology extends the Servlet technology, which means anything you can do with a...
Q. Complete the “areAnagrams(String a, String b)” method so that it returns if two given input strings are anagram or not?
|
1 2 3 4 5 6 7 8 9 10 11 12 |
public class InputAreAnagrams { public static boolean areAnagrams(String a, String b) { throw new RuntimeException("Not yet implemented...."); } public static void main(String[] args) { System.out.println(areAnagrams("leading", "aligned")); } } |
A. An anagram is a word formed from another by rearranging its letters. For example, … Read more ›...
It really pays to jog your memory prior to job interviews to ace the open-ended questions like……As a Java developer, can you think of a time where you…….? Q1. Can you think of a time where you accomplished QuickWins for your company? A1. … Read more ›...
Q01. What are the Compute options Azure provide? A01 Azure compute services can be IaaS, PaaS and Serverless. Azure provides: 1) Azure Virtual Machines (i.e. VMs) are IaaS allowing you to deploy and manage VMs inside a virtual network (VNet). … Read more ›...
I have a good news, I got job offer. I like to share with you from my bottom of my heart feeling thankful to you.