Java Basics
Monitoring and Profiling using VisualVM-1
I executed a simple GUI application which would load the CSV file and parse it and show the contents in a JTable. When the applications started- There was a JFrame, 2 JPanels, a JLabel and a JButton with an Icon. I wanted to monitor the Heap size variations, the number of Classes, Threads details and also wanted to profile the application. So i thought of using VisualVM. The following are the results and snapshots of profiling using VisualVM. Note that the application had only one public class MainFrame in gui package. Also note that i was using the Nimbus Look and Feel.
Read Full Post | Make a Comment ( None so far )First Attempt @ Servlets, JSP and Cookies
I have been doing Servlets and JSPs from quite some days and yeah they have been lots of interesting stuff in it, And this is my first attempt at Web Technologies. I would recommend beginners to use Head First Servlets and JSP book. It’s a superb book to read, one can enjoy reading and the [...]
Read Full Post | Make a Comment ( 2 so far )Passing Variables into Methods- Java Passing Mechanism Explained
Every Programming Language has its own way of passing the variables into methods. There are basically two ways of passing variables- Pass by Reference and Pass By Value. The former deals with the passing of reference or pointer to particular variable and the latter involves passing a copy of the variable to the method. C [...]
Read Full Post | Make a Comment ( 7 so far )Initialization Blocks in Java
Apart from methods and constructors, Initialization Blocks are the third place in a Java Program where operations can be performed. Initialization Blocks come in two flavours:
Static Initialization Blocks: Runs first when the class is first loaded. Declared by using the keyword “Static”
Instance Initialization Blocks: Runs every time when the instance of the class is created.
Shadowing Variables in Java Demystified
One of the meanings of the word “Shadow” in the Oxford Dictionary is “a weak or less good version”. Shadowing in Java is also something similar. One can shadow a variable in several ways. I would try to describe the one most comman ways which would trip most of us i.e. “Hiding an instance variable [...]
Read Full Post | Make a Comment ( 3 so far )Static Members: Static Methods and Static Variables
Why do we need Static members?
There are situations in which the method’s behaviour does not depend on the state of an object. So, there will be no use of having an object when the method itself will not be instance specific.
Let us consider another situation where in we want to keep a count of all [...]
Casting Reference Variables- Downcasting, Upcasting
Let us consider two classes class Animal, a more generic class and class Cat, a more specific class i.e a more specific animal. Let us settle for simple definitions for both the classes so as to get the concept right.
/*
The definition for more generic class Animal
Notice the eat() method, which will be inherited by all [...]
Things one has to know about Interfaces in Java
The following article is mainly focused at beginners who are not much familiar to Java. It can also be a quick recap tool for Java Developers.
What are Interfaces?
Interfaces are 100 percent abstract classes i.e it defines only abstract methods and constants. But while an abstract class can define both abstract and non-abstract methods, an interface [...]
