Core Java Interview Questions
Q: What is the difference between an interface and an abstract class? A: An abstract class can have instance methods that implement a default behavior. An interface can only declare constants and instance methods, but cannot implement default behavior. An class is abstract if it is defined with the keyword [...]
Continue reading about Java/J2EE Interview Questions & Answers
Introduction
This is a java class file for sending mails using java APIs. It requires two jar files to be set in the class path. Also Java J2SDK is required to compile or run this code. A valid SMTP server ip is required and that should be authenticated by a valid user id and password.
Limitations [...]
Continue reading about Java Class for Sending Email using Java API
Introduction
Commons-Email provides an API for sending email. It is built on top of the Java Mail API, which it aims to simplify. Some of the mail classes that are provided are as follows:
SimpleEmail – This class is used to send basic text based emails.
MultiPartEmail – This class is used to send multipart messages. [...]
Introduction
Voice based solutions are needed when there is a legal requirement to play back an already recorded statement, recording and playing back the telephony conversations, speech recognition systems, visually impaired people, for training customer support representations and so on. Voice based solutions can be implemented using J2SE Java Sound API or Java Media Framework (JMF). [...]
In Oracle 10G, when we return from a java stored a response which size can be greater than 32767 (PLSQL limit for a varchar2) then we get “ORA-24345: A TRUNCATION OR NULL FETCH ERROR ” error.
To avoid getting this error is to return a Clob instead of Varchar2.
Steps to be followed
Create a [...]
Continue reading about Good to use CLOB instead of VARCHAR2 in Java Stored Procedure
HOW TO USE LOG4J WITHIN ECLIPSE WHILE RUNNING JUNIT TEST CASES If the loggers are not initialized or set properly in eclipse while running the junit test cases we get the following error message:
“log4j:WARN No appenders could be found for logger log4j:WARN Please initialize the log4j system [...]
Continue reading about How to print loggers(log4j) while running Junit Test cases.
Overriding allows programmers to replace a method’s implementation with new code. Overriding is a handy feature, and most OO programmers make heavy use of it. If you use the AWT 1.1 event handling model, you’ll often override listener implementations to provide custom functionality. One easy trap to fall into with overriding, is to mistype the [...]
Continue reading about Mistyping the name of a method when overriding
This is an easy error to make. If you’re used other languages before, such as Pascal, you’ll realize just how poor a choice this was by the language’s designers. In Pascal, for example, we use the := operator for assignment, and leave = for comparison. This looks like a throwback to C/C++, from which Java [...]
Continue reading about Comparison assignment ( = rather than == )
Many programmers, particularly when first introduced to Java, have problems with accessing member variables from their main method. The method signature for main is marked static – meaning that we don’t need to create an instance of the class to invoke the main method. For example, a Java Virtual Machine (JVM) could call the class [...]
Continue reading about Accessing non-static member variables from static methods
When we use the == operator, we are actually comparing two object references, to see if they point to the same object. We cannot compare, for example, two strings for equality, using the == operator. We must instead use the .equals method, which is a method inherited by all classes from java.lang.Object
Here’s the correct way [...]
Continue reading about Comparing two objects ( == instead of .equals)




