Towers of Hanoi – a Java Programming Solution

Towers of Hanoi is a game with three poles labeled A, B and C and several different-size numbered disks, each with a hole in the center. Initially, all of the disks are on pole A, with the largest disk on the bottom, then the next largest and so forth. Here is how it looks when you start the game:

towers of hanoi

The object of the game is to move all of the disks from pole A to pole B; pole C is used for temporary storage. Here are the rules of the game:

  • Only one disk may be moved at a time

Interface In Java Programming – An Example

An interface in java is a collection of abstract methods and constant identifiers. There are no defined methods and  no fields. From that definition, if a class provides method definitions for an interface’s methods, the class is said to implement the interface. The class may also define other methods. In this post, we will see how to use an interface in java.

interface in java

The Example – An Interface In Java

In this example, we will create an interface called Employee for all the employees in a company. The information read in for each employee in question consists of employee’s name and gross pay. So, we need to list the responsibilities of the interface that will help us define the methods’ specifications. In other words, the responsibilities means the services provided to users of any class that implements the Employee interface. So here they are:

Object Oriented Programming In Java – Inheritance

Object oriented programming in java is very powerful and a clear understanding is important. While I was trying to dig deeper, I realized that there is more to it than I actually knew. So, I looked around the web and spent some time on StackOverflow! Now let us create a simple file here

public class Base{
public static void main(String[] args]){
//do some cool stuff here