Skip to main content

Posts

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: Auto completion Syntax Highlighting Code debugger Profilers Multipage editors Auto completion: Auto completion feature suggests APIs [methods, classes and interfaces] and keywords etc as we start typing in the e...

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 brough...

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. Exception: 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:            ArrayIndexOutOfBoundException          NullPointerException Error: 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: T...

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.   Program: 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) { super(title); Dimension size = getPreferredSize(); size.w...

Exception handling and java keywords

Exception: Exception in a programming language and in English language is pretty similar. Exception means being different from or not following the rules. And in programming language like Java, exception is  an event which occurs during the execution of a program that disturbs the complete flow of application or program. When something beyond expected happens while executing a program is considered as an error. handling these errors or abnormality is called as Exception handling. Exception Handling: Exception handling in java is managed with the help of java keywords and java API support..              1. Java Keywords             2. Java API support Java Keywords:   There are 5 keywords in Java.           1. Try           2. catch           3. finally           4. throw    and 5. throws These five keywor...

Java and OOPS concepts

Java is an object oriented programming language which can be downloaded and installed in your local Machine from java.com To explain java binaries and tools requires block diagram which gives clear picture. For now I brief few important tools. JDK - java development toolkit JVM - Java virtual machine JRE - Java Run time environment From oracle site we can download JDK which is shipped along with JVM and JRM. Mostly java programmers need the JDK. For end users JRE alone is enough. Basic OOPS characteristics are Inheritance Encapsulation Abstraction and Polymorphism The above concepts collectively makes application software extendable and changeable with less effort. Also helps in Developing design patterns. Design patterns gives solutions for common challenges usually a programmer faces while development applications. Factory design pattern, Abstract design pattern, Builder pattern etc. I explain these Design patterns in another article. Inheritance : Inherita...

Core Java: Immutable objects and mutable objects with an example

Immutable objects and mutable objects with an example  In object oriented programming language, in short OOPS, every problem, precisely every requirement is viewed as an object. Understanding the problem in this point of view brings many good things possible in programming like encapsulation, abstraction, polymorphism and inheritance. Anyways this post is not intended for describing benefits of OOPS. Object could be any thing. Let us take Car  for an instance. Basically car is an object and it has name, wheels, metal body, engine, maximum speed,  gear box etc as properties. Let us consider the car name is Ferrari, maximum speed is 200 km per hr with 6 gears. While driving the car driver can change the speed of the car and change the gear etc. So while car is running it's current speed, current gear are considered to be state of the object. The current speed can be changed using accelerator and gear can be changed using gear box. These can be considered as ...