Java

This category contains all the posts under core java and ways to program in Java

Object Oriented Programming – Inheritance in detail

Introduction This article is in relation to the interview questions asked to the java candidates in particular. I have been interviewing candidates and I find them very confused between the features of OOP. Most of the time people are not very clear about Inheritance. We will discuss this in detail. To read more about my articles on java and it's concepts, please visit Java Articles. Purpose of the article This article is for the novice and the experts as well, I always believe that the concepts are something which has to be read and brushed up again, here we will discuss Inheritance in d...
Read More

Using Abstract Classes And Interfaces

Introduction This article is going to be a short one with some details about the interfaces and abstract classes in java. There have been a lot of confusion about using them interchangeably, but as I always say, encapsulation is a strong feature of java and one of the most important rule in java is that every thing has its own purpose. Hence, if two distinct features (abstract class and interface) exists in the language, then they must have different reasons as well. Purpose of the Article The article describes in detail using Abstract Classes And Interfaces, what is the difference between ...
Read More

Interview Question – Static variables

Introduction This question was asked in a recent java interview in Goldman Sachs, this isn't complicated but candidates might get confused solving it. This is about static blocks and static variables initialization, so I publish this article under the heading Interview Question - Static variables. To get updates on the other articles in the series, please use the Subscribe feature on the right panel. Problem Statement What would be the result when the below code is executed? [crayon-59e9eda2915b1724264219/]   Solution What is the approach for solving this question? Remember your b...
Read More

Comparable and Comparator – a detailed discussion

Introduction This article is in response to a question asked on one of the groups I am a member of. What is the difference between Comparable and Comparator interfaces in Java. Why there are two interfaces if what they do is provide a method to compare. This might not seem to be a topic worth discussion for people who are experts in java, but yeah for many of my friends out there, it might help. Purpose of the article The article will describe in detail the difference between the interfaces Comparable and Comparator and also define the usages of both of them. One thing we need to underst...
Read More

Basics of Spring Integration

Introduction to Basics of Spring Integration With growing business needs and the number of components interacting to each other in a wide business setup, there arises a need for integrating the systems effectively. A traditional approach of integrating various systems is to connect each system with the remaining systems. This precisely means that if we have N systems to integrate, there would be N-1 connections from each system. Here we try to achieve this using Spring Integration. Assumptions made while writing this blog: You have a basic understanding of Spring framework and dependency...
Read More

Failed to initialize an instance of org.apache.velocity.runtime.log. ServletLogChute with the current runtime configuration.

This is another problem I went into where I was trying to use apache velocity template for sendinng mails using pre-defined templates. Everything looked fine until I ran into the issue which threw the error org.apache.velocity.exception.VelocityException: Failed to initialize an instance of org.apache.velocity.runtime.log.ServletLogChute with the current runtime configuration. The velocity template is very easy to use. below is a sample code to use Velocity template: [crayon-59e9eda29350f304364888/] This works perfectly fine if you are running the application on your local system...
Read More

Handling two ComboBoxes in Vaadin

This post is a solution to a problem I faced developing an application in Vaadin. It is related to handling two ComboBoxes in Vaadin, where the values in the second ComboBox depend on the selection of the first ComboBox Handling two ComboBoxes in Vaadin The Vaadin form component is easily handled and rendered with a FormFieldFactory. So I have a Form called MusicForm [crayon-59e9eda293f60686983259/] Here is the FormFieldFactory code: [crayon-59e9eda293f6e346916700/] The key here is to add the comboBox as a field in the uiContext which eventually is of type MusicForm. When the user sel...
Read More