
Understanding the Current Stack Under Execution
Most of the time, you probably want to understand the flow to solve certain problems. Java provides an easy approach to knowing the current stack. Code snippet: public class DumpStack{

Most of the time, you probably want to understand the flow to solve certain problems. Java provides an easy approach to knowing the current stack. Code snippet: public class DumpStack{

Private static final Log log = LogFactory.getLog(MyClass.class); It is a good idea to store the log instance in a static final variable, because: No problems with serializable classes Initialization cost

class SuperClass{ public static void main(String args) { //do Nothing }}class MyClass extends SuperClass{ public static void main(String args[]) { //do Nothing }}public class NewClass { public static void main(String

String name = …String attribute = …String xml = “”+””+ name +””+”; Many beginners are tempted to create an XML file like the one listed above using String operations because

Memory leaks don’t have to be hard/scary/tedious problems to solve if you follow the three simple steps mentioned below: Step 1: Capture baseline heap dump You need to capture heap

Certain aspects of your code may want to perform certain activities in a loop and wait infinitely for a command. However, the “while(true)” command is an easier way to achieve

This method creates a PDF file and returns the binary PDF data as a byte array. This particular line of code supposes that the resulting file is small and fits

In case you are developing an application that is based on time zones, this example will be of help. Lisiting 1. import java.util.TimeZone;public class AvailableTimeZones{ public static void main(String args[])

The getCustomValue() method on the enum returns the custom value associated. You can use this mechanism when you want to override the default ordinal with a custom ordinal. Code snippet public