Blog Archives
1 19 20 21 22 23 24 25 26 27 28

Iteration Vs Recursion in Java

Q1. Can you write a sample code that will count the number of “A”s in a given text “AAA rating“? Show both iterative and recursive approaches?
A1.

Iteration:

A for loop to traverse through each character of the String “AAA rating”,

Read more ›



Jacoco for unit test coverage with SonarQube tutorial

This tutorial extends SonarQube with Maven Tutorial – Code Quality for Java developers to use Jacoco for tracking unit test coverage. Jacoco is the default code coverage tool that gets shipped with SonarQube. SonarQube can also be configured to use Cobertura as the code coverage tool.

Read more ›



Java 8 String streams and finding the first non repeated character with functional programming

Q1.Find the first non repeated character in a given string input using Java 8 or later?
A1.Extends Find the first non repeated character in a given string input with Java 8 functional programming.

For example, an input string of “stress”

Read more ›



Java BDD (Behavior Driven Development) interview Q&A

Q1. What is BDD? A1. BDD is principally an idea about how software development should be managed by both business interests and technical insight. Test-driven development focuses on the developer’s opinion on how parts of the software should work. Behavior-driven development focuses on the users’ opinion on how they want...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java coding practice problems – prime and powerful

There is no other way to pass the Java coding tests other than practicing. I have failed Java coding tests due to lack of practice. How often do you get work with tree and graph data structures? Ho often do you work with algorithms?

50+ Java coding practice problems Links:

Can you write code in Java?

Read more ›



Java coding question on recursion and generics

Q. Can you write Java code to compute a collection of numbers supplied to it? The computation could be addition, subtraction, etc. Use recursion to compute the numbers. Here are some requirements to take into considerations. 1. It should be flexible enough to convert from Recursion to iteration if required....

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java Generics in no time “? extends” & “? super” explained with a diagram

Generics in Java can be be a bit tricky to get your head around. Hope the explanation below enhances your understanding of generics. This complements 5 Java generics interview Q&As with examples. Raw List, List <Object>, and List<?> A raw List: is a heterogeneous mixture or a mixed bag that...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


jBehave and BDD example

To appreciate jBehave, let’s look at a better example here. This example is about a science formula   Speed = distance / Time. So, given  distance and time, calculate speed given speed and time, calculate distance given speed and distance, … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


jBehave and jUnit for BDD

This extends the jBehave — Behavioural Driven Development (BDD) Q&A to use the same example with jUnit testing. Step 1:  Make sure that you have both jUnit and jBehave in your pom.xml file.

Step 2: Refer to Behavioural Driven Development (BDD) for all the jBehave implementation. … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


jBehave with tabular story data

This extends the previous jBehave and BDD tutorials. The story is in a tabular format as shown below. This is an industrial strength example. Step 1: The story file  which supplies a list of transactions as an input (i.e. via Given) and validates against a list of transactions that are...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


JMeter for performance testing REST services with BeanShell

This post extends 8 JMeter Performance testing Interview Q&As to cover JSON HTTP post. Now a days, a single page interactive web sites are very popular, and they post JSON based data back to the server to create a new record or to update an existing record. Step 1: Firstly,...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


JUnit with Hamcrest

Q1. What is Hamcrest, and what is its purpose?
A1. HAMCREST is an anagram for MATCHER. The purpose is to match the assertions the BDD (Behavior Driven Development) style. In short, reads better like English statements. So,

Instead of:

with Hamcrest,

Read more ›



jvisualvm to debug deadlocks in Java

This extends JConsole for debugging deadlocks in Java applications, using jvisualvm that gets shipped with your JDK. Step 1: Java code that creates a dead lock situation by a) thread-0 holding on to lock1 and waiting for the lock2, … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


1 19 20 21 22 23 24 25 26 27 28

300+ Java Interview FAQs

Tutorials on Java & Big Data