Suppose you want to create a list object in Java and populate it with some default elements, how would you go about coding it? One will pursue one of the following approaches: (If you have any other approach feel free to share them via the comments and we will update the post accordingly). In the …
Java
Creating JSON Data Using The Java JSON API (JSR 353)
JSON has been around for quite sometime now and lot of languages are offering out of the box support for parsing and creating JSON data. The JDK didn’t have support for parsing and creating JSON data out of the box. One had to make use of libraries for parsing and creating JSON data like Google …
JAXB Tutorial
This tutorial is introduction to Java Architecture for XML Binding (JAXB). JAXB tutorial is based on the Java 6.0 and later versions. JAXB is XML Binding API which defines the API for reading and writing the XML files from Java objects. As the binding word defines, XML and Java objects are binded together for the …
Basics of Java Interface Usage
In this article we will see how to use Java interfaces correctly with with some examples. Using Java as Interfaces is often not used or wrongly used. This article demonstrates the practical uses of Interfaces in Java. First of all it is important to understand what is an interface? Let us create a “contract” where the …
Garbage Collection in Java
In this article we will cover the proper use of Garbage Collection. Let us learn how it works, and understand how to induce the Garbage Collection. The Garbage Collection is a tool coupled to the JVM, that performs cleanup of objects in memory (Read: static utility for objects) which are of no further use. Our application will constantly suffer …
Best Practices to Override toString Method in Java?
In this article to we will see how to override the toString method and what are the best practices in Java. Java provides a default implementation for the method toString through a class java.lang.Object which is inherited by all Java classes . However, what it returns is not very informative. Your returned value is composed …
Difference between Checked and Unchecked Exceptions in Java
In this article we will understand the differences between Checked and Unchecked Exceptions in Java language.Exception handling is essential to make a robust application, because the user does not want to see a stacktrace on your screen, but a well-written message indicating that only an error occurred. All the applications are subject to failures, and …
Dynamic Class Loading using Java Reflection
In this article we will discuss the concept of Java Reflection. Java Reflection is used to determine methods and attributes that will be used in a certain class at runtime.The Reflection in a nutshell, is used to determine methods and attributes that will be used in class (you do not know) at runtime. There are …