Understanding Packages and classpath in Java

What is Package?

Package in Java is a way of organizing the code. In simple terms, its an directory or directory hierarchy which is used to store the code files. A statement like import java.util.Scanner means that on system java is a directory which in turns have sub directory name util, which have Scanner class. To create custom package the procedure is to create a directory and sub directories and declare it java file. Consider a class A, which belongs to a package org.demo, save it as A.java. Continue reading “Understanding Packages and classpath in Java”

Comparing user defined objects : Comparable and Comparator

Comparison plays important role in any programming language. Almost all the sorting techniques involves comparison. In Java, all the predefined classes and primitive data types supports comparison. User defined data types needs to provide the comparison logic, Comparable and Comparator comes in picture. For the primitive data type, how to compare is inbuilt and can be achieved using different comparison operators like <, >, <=, >=. Assume int a = 10 and int b = 20, then a<b is true. Continue reading “Comparing user defined objects : Comparable and Comparator”

Understanding Object class

Object class is a super class of all class in Java. All inheritance hierarchies starts from Object class followed by other class. Consider example class Shape as parent class of Rectangle and Circle class, in that case Object class is parent or super class of Shape class hence Rectangle and Circle class not only get methods and properties of Shape class but also Object class. This article shows the methods of Object class which is inherited by all the classes that are predefined or user defined. Continue reading “Understanding Object class”

Introduction to Java – What is Java?

Java is a general purpose programming language. The main feature that makes the Java language popular is “WORA” i.e. Write Once Run Anywhere. It means programs once written can run on any platform. Program written in Windows platform and compiled on Windows platform can run on Linux and Mac platform without recompiling the program or modifying the source code. This is achieved by generating the bytecode during the compiling process. Bytecode is an intermediate format which is than interpreted by JVM [ Java Virtual Machine ] at run time. As name says its a Virtual machine and not a physical machine its job is to translate bytecode in to executable code for the platform on which it is running. Following diagram shows the whole process. Continue reading “Introduction to Java – What is Java?”

Jenkins Monitoring with JavaMelody

Jenkins is an open source Continuous Integration Server that is one of the most popular in industry. Recently in April 2016, Jenkins 2.0 with focus on Continuous Delivery has been released and that is one of the major step for open source CI server and its future.

Continue reading “Jenkins Monitoring with JavaMelody”

Managing Jenkins Master and Slave Nodes

A master represents basic installation of Jenkins and it handles all tasks for build system. It can satisfy all user requests and it has capacity to build projects on its own. A slave is a system that is set up to reduce burden of build projects from the master but delegation behavior depends on the configuration of each project. Delegation can be configured specific to build job. On Jenkins dashboard, go to Manage Jenkins. Click on Manage Nodes link. It will provide information on all nodes as shown in below figure.

Continue reading “Managing Jenkins Master and Slave Nodes”

Introduction to Jenkins and its features

Continuous Integration (CI) is one of the most popular application development practices and base component for DevOps Culture in modern times. Developers check in for bug fix, new feature development in the code repository. Open Source or commercial CI tool verifies the integration process with an automated build (Build tools such as Ant, Maven, and so on…) and automated test execution framework (such as JUnit) to detect issues with the current source of an application, and provide quick feedback. It also integrates source code analysis using Sonar.

Continue reading “Introduction to Jenkins and its features”

Oracle Certified Associate: Java 8 default and static methods in interface

We all know about the default access modifier in Java. From Java 8, we can add default method(s) to an interface. The default methods are non abstract method which have implementation i.e. to say have a method body. A part from default, Java 8 also supports static method. Continue reading “Oracle Certified Associate: Java 8 default and static methods in interface”