James Gosling: idealism, the Internet and Java, Pt I

Sunday 9 May 2021

Demonstration of Java NullPointerException

NullPointerException causes and reasons

Since Java is object oriented programming language, every thing is considered to be an object. and there is always a scope of an object to be null or "No value". 

Since Java supports primitive data types, Java is not considered to be pure Java object oriented programming language. 

Few Notable points about NullPointerException

  1. NullPointerExceptions is unchecked exception
  2. Please read post Exception handling and java keywords before reading this article
  3. Usually if program tries to fetch the value from reference and finds nothing as value, then program throws NullPointerException
  4. 'Zero' is not null
  5. And empty String is not considered to be null
  6. It is not the subclass of RuntimeException class

Demo code that throws NullPointerException 

package com.allabtjava.blog;

public class DemoNullPointerException {

class BeanDemo {
String name;
Integer ID;
public String getName() {
return name;
public void setName(String name) {
this.name = name;
public Integer getID() {
return ID;
public void setID(Integer iD) {
ID = iD;
public DemoNullPointerException() {
public void createNullPointerException() {
BeanDemo bean = new BeanDemo();
bean.setName("All about Java!");
if(bean.getID() == null) {
throw new NullPointerException();
}else {
public static void main(String args[]) {
new DemoNullPointerException().createNullPointerException();


All about Java!
Exception in thread "main" java.lang.NullPointerException
at com.allabtjava.blog.DemoNullPointerException.createNullPointerException(DemoNullPointerException.java:36)
at com.allabtjava.blog.DemoNullPointerException.main(DemoNullPointerException.java:44)

Monday 26 April 2021

Evolution of Java Programming Language

Evolution of Java:

First of all, The Java programming language and it's tools that we currenly using is not what actually expected. This language started as a project to give solutions for embedded devices, mobile phones and other portable peripherals. 

Initially, the Java was called Oak. 

Why it is Oak first..? and Why it transformed to Java..?

The team of five technocrats including Dr. James Gosling and also known as Dr. Java, together working on a project, which expected to give solutions on embedded devices, portable smart devices and TV Set top Boxes etc. at Sun Micro Systems. 

In the process of achieving this solution, at their breaktime, team used to relax with a coffee by having a glimpse on a scenery of Oak tree next to their facility. 

Once the project has come to conclusion and in the process of giving a title to it, they noticed the Oak trees [Always observing them in their break time], they named this programming language as Oak.

Oak Logo

Why it transformed to Java..?

When the first version of Oak is about to release, The trademark search revealed that Oak is already registered for Oak Technologies company. Then, Java was named to this project.

In the previous paragraph, it is told that, "team used to relax with a coffee by having a glimpse on a scenery of Oak trees next to their facility...". When one of the team members asked to barista, [Usually a coffee bar tender is called with that name] about the name of the coffee bean that she/he serves in the break..? The reply was "Coffee is made of Java Beans.."

Immediately the name of the project confirmed to be Java and first version 1.0 is released into the industry in the year 1994. Rest we know, how Java programming language was developed and evolved into the bigger scope like smart phones, Inbuild JRE into web browsers etc.

The Oracle claims that more than 1 billion devices uses JRE and millions of developers uses Java and it's tools every day.

Java Version 16  is released in March 2021.

Few of the Java products are:

  • TV Set top Boxes,
  • Android OS
  • Realtime JVMs
  • Embedded devices
  • Almost all Browsers

Java evolved almost 30 years ago since 1994 from it's first version and almost all devices used Java and it's products directly or indirectly in their daily use. Hope Java continues it's charisma infinity days and will do wonders.

Happy Coding..! :)  

Thursday 22 April 2021

Java programming language and IDEs

IDE: Integrated Development Environment

Integrated development environment, in short IDE is a convenient environment to write, execute and  debug the code or programs on a single platform. IDEs support not only writing code smoothly but also provides a provision to write scripts, XML files, simple text files and build scripts like Ant, Maven are few among others.

In short IDEs are development environments to execute complete development activities using one application.

IDEs and Editors

IDEs and Editors fulfills the same purpose. That is writing code. But IDEs are glued or closely works with respective programming language's compilers, runtime environments, profilers and other language specific tools to put developer in a comfortable zone. 

Some of the features of IDE:
  1. Auto completion
  2. Syntax Highlighting
  3. Code debugger
  4. Profilers
  5. Multipage editors

Auto completion:

Auto completion feature suggests APIs [methods, classes and interfaces] and keywords etc as we start typing in the editor. This helps in not spending much time on typing APIs.

Syntax Highlighting:

Syntax is a structure of arranging APIs, operators and keywords to make computer instructions, subsequently which becomes executables.

Class names, method names, operators and Keywords are highlighted with different colors and formats to differentiate them and to increase the readability. Syntax highlighting helps importantly when single program or file has thousands of statements or lines.

Code Debugger:

Debugger is a feature to identify bugs, errors and shows intermittent results of set of programming instructions or statements and subsequently helps in correcting and developing a bug free computer programs


Profiler is the tool usually shipped along with JDK [if it is a Java] and helps in understanding the memory usage of a computer application graphically. These graphics includes different charts and GUI controls. 

Profilers gives information about

  •  Memory usage,
  •  details of Threads being used,
  •  Heap dumps,
  •  CPU utilization etc

Multipage Editors:

Multipage editors shows the same file content in multiple perceptions. For example XML file content can be viewed in different views. 1. Hierarchical view 2. Simple text format and 3. Graphical view etc


Few more notable points about IDEs and Editors:

  1. IDEs are scalable to support multiple programming languages
  2. Editors can not be glued to a programming language's compiler
  3. Editors does not support Auto completion
  4. Editors does not support code debugging

IDEs for Java and IDEs built using Java

Usually IDEs are developed using different programming languages where, few of them are open source and few are commercial. Few of the industry endorsed IDEs are:

  • Eclipse
  • Netbeans
The above listed IDEs are developed using Java programming language and also used to develop Java applications and programs. It is little tricky to understand for beginners. 
And both IDEs share common features like scalability, modularity, code completion etc.
You can download Eclipse and Netbeans distributions from their respective sites.

Happy Coding! :)

Sunday 11 April 2021

Agile Methodology with SCRUM Framework Basics

Software development activities can be managed and taken care with different life cycle models. These life cycle models has became legacy since few years. Few of the available Software Development Life Cycle Models in short SDLC are Win-Win Model and Waterfall Model etc.

These traditional models has different phases of development. 
       1. Requirements 
       2. Analysis 
       3. Design 
       4. Implementation 
       5. Test 
       6. Documentation 
and 7. Maintenance 

In SDLC, the above stages are freezed one after the other. If developer is in Design phase and realized that there could be a possibility of change in requirements, then it is not possible to go back one phase and fix in Requirement phase. 
These scenarios and use cases has brought Agility in to existence in software development activities.  

Agility in English: 

Agility means "able to move quickly and easily".  Being agile in software development makes the development move or progressed quick enough and flexible to go back and forth through out the development phases and complete the activities on time.

Agile Methodology:

"Agility is the ability that gives better productivity..."

Agile is the ability to create and respond to change. It is a way of dealing with and ultimately succesing in an uncertain environment. Agile methodology has different subsets also called as frameworks. 
SCRUM and Kanban are few among others. These frameworks can be adapted as process solutions based upon different development needs.

SCRUM Framework:

Scrum is a process framework used to manage product development and other knowledge work.

SCRUM framework manages the development activities biweekly, 3 weeks or 4 weeks. This duration is called as Sprint. Usually it is not recommended to have more than 6 members or developers in a team.


Sprint is a duration of time where few backlogs are realized as tasks and completed by development team. Once the Sprint is completed these software changesets goes into release version of the application software.
Based on the need Sprint duration can be 2 or 3 or 4 weeks. But most of the Scrum experts suggest Biweekly sprints.

SCRUM and Meetings:

    1. Standup call
    2. Review Meeting
    3. Grooming Session
    4. Retrospective

Standup calls are held everyday morning that lasts for 15 minutes. And following are discussed:

    1. What is done yesterday?
    2. What is planned today?
    3. Any Roadblocks?

NOTE: It is not recommended to consider more than 15 minutes for Standup meeting

Review Meeting is held at the end of the Sprint showing different works and demos of Sprint's development activites.

Grooming Session lasts for one and half hours. During this session tasks are pulled from backlogs and discussed the following:

    1. Estimations for the Tasks
    2. Deciding the priorities
    3. Severity levels
    4. Assignments

Retrospective meetings are held after the end of Sprint and discussed about:

    What went correct..?
    What went wrong..?
And Appreciations if any...

Scrum framework and few notable points:

  1. All requirements are consolidated as backlogs along with its descriptions and other details.
  2. Estimations of backlogs are done with the Poker Cards
  3. Poker cards are numbered in a Fibonacci order
  4. SCRUM is managed by Certified SCRUM Master or SCRUM Coach
  5. If Standups are not held with in 15 minutes, can be considered as limitation.
  6. Virtual Boards are considered over Physical boards, if members are in remote locations 

SCRUM and Agile Supporting Tools:

  1. Microsoft Azure Boards
  2. Atlassian JIRA
  3. IBM - Rational Team Concert 

SCRUM Limitations:

  • Geographically if team members are located in different places, Agile may not be effective

Monday 11 January 2021

Java API support for Exception Handling

First of all, please read below blog post to understand basics of Exception Handling in java.

Exception handling and java keywords

To continue from there, Basically Java default API has hierarchy of  java classes to support different uses cases of exceptions. 

The parent class of all Exceptions and Errors is Throwable. Please check below pictorial representation of  API Hierarchy 


The class Exception and any subclasses that are also not subclasses of RuntimeException are checked exceptions.

And all subclasses of RuntimeException and RuntimeException class itself are Unchecked exception. Rest all are Checked exceptions

Examples of Unchecked Exceptions: 




An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions.

Examples: The ThreadDeath error

Wednesday 6 January 2021

Java - Swing custom components - Rounded JButton

Unlike AWT, Java Swing tool kit provides feasibilty to create custom components and containers.

To understand Java GUI toolkits more clearly, please read my other articles on Swing and AWT. 

In this article I focus more on building custom components.

Let us see how to create simple Rounded JButton. The below program demonstrates How rounded JButton can be created and added to a JFrame.



import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Shape;
import java.awt.geom.Ellipse2D;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class RoundedJButton extends JButton {

private static final long serialVersionUID = 1L;

public RoundedJButton(String title) {
Dimension size = getPreferredSize();
size.width = size.height = Math.max(size.width, size.height);


protected void paintComponent(Graphics g) {
if (getModel().isArmed()) {
} else {
g.fillOval(0, 0, getSize().width - 1, getSize().height - 1);


protected void paintBorder(Graphics g) {
g.drawOval(0, 0, getSize().width - 1, getSize().height - 1);

Shape shape;

public boolean contains(int x, int y) {
if (shape == null || !shape.getBounds().equals(getBounds())) {
shape = new Ellipse2D.Float(0, 0, getWidth(), getHeight());
return shape.contains(x, y);

public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {

JFrame frame = new JFrame();
frame.setTitle("It's all about Java...");
frame.setSize(150, 150);
GridLayout layout = new GridLayout();

JTextField field1 = new JTextField();
field1.setText("This is a textfield!");

RoundedJButton button = new RoundedJButton("Browse");


SwingUtilities.invokeLater(new Runnable() {
public void run() {

There are two parts in the program. First part creates RoundedJButton component by extending JButton. and second part creates JFrame and appends two components. 1. RoundedJButton and 2. JTextField

First Part:

RoundedJButton overrides paintComponent(Graphics g) and paintBorder(Graphics g) to get the circled shape to the Button. 

Second Part:

Second part contains main method which creates JFrame object and adds 2 components to JFrame dialog.

Also applies System look and feel by using following


I will explain clearly about pluggable look and feels also known as PLAF in future articles.

That's all for now!

Happy coding... :) 

Popular posts

Demonstration of Java NullPointerException

NullPointerException causes and reasons Since Java is object oriented programming language, every thing is considered to be an object. and t...