Blog Archives

Tree structure – calculate average recursively & iteratively in Java

Q. Complete the following “TreeProcessingImpl” class ….. so that the unit tests shown below pass? Skeleton Code

Unit Tests

A. Solution 1:

Solution 2: Using recursion for getAverage(…) and iteration for getSum(…)

Key Points #1: Recursion can cause stack overflow exception if you…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Feel free to evaluate the quality of the contents Free FAQs | HomeTry Log In | Register
Posted in member-paid, Passing the unit tests, Tree structure

Working with monetary values

Q. Complete the following “MonetaryProcessingImpl.java” class … so that the unit tests shown below pass? Skeleton code

The unit test that fails

A. Code that passes the test cases

Key Points Take note that test cases test for exceptions being thrown as well. So, input…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Feel free to evaluate the quality of the contents Free FAQs | HomeTry Log In | Register
Posted in member-paid, Passing the unit tests

♥ Prerequisite: if want to work with Maven & eclipse

Here are the basic steps as to how I set up “passing” project using maven & eclipse for the coding exercises. If you are using other IDEs or command line approach then you can ignore this prerequisite. Just create the relevant packages and copy the classes in the passing the

Read more ›

Posted in Passing the unit tests

Working with a given input string & character processing

Q. Complete the following StringProcessingImpl.java” class ….. so that the unit tests shown below pass?

Unit test

Solution

Key points #1. The encode method is using the rot13 encoding that is used for hiding offensive material from accidental viewing, to not give away naughty jokes and discussions,…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Feel free to evaluate the quality of the contents Free FAQs | HomeTry Log In | Register
Posted in member-paid, Passing the unit tests

Processing data from a file & sorting them

Q. Complete the following “DataProcessingImpl.java” class ….. so that the unit tests shown below pass?

Following unit tests fail. You need to implement the logic to pass these tests.

Solution:

Key Points If you are using Java 7, use Try with resources, which has the AutoCloseable interface…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Feel free to evaluate the quality of the contents Free FAQs | HomeTry Log In | Register
Posted in member-paid, Passing the unit tests

Take the road less travelled

Fast-track by empowering yourself to choose from multiple job offers, open more doors and increase your earning potential.

800+ Java Interview Q&As – ♥ Free | ♦ FAQs

open all | close all

Pressed for time? 200+ Quick Prep

open all | close all

16 Java Key Areas to be a top-notch

open all | close all

100+ Java Tutorials – Step by step

open all | close all

100+ Java Coding Exercises

open all | close all

How good are your

open all | close all