Bringing The Pieces Together…

Recently, one of my BCB readers asked me a question that brought about this blog topic, he said “I have read through your several posts but how do I bring them all together and write a complete functional code?” Then I thought to myself that he was right, probably other readers might also have the same challenge bringing all the pieces together. Therefore, in this post and my next couple of posts, we will be taking a deep dive, referring back at every topic on Java we have previously dealt with on this blog in order to write a complete functional code. I hope you are ready to get your hands really dirty…lol.

Assumption: To start with, I assume that by now you have installed Java and you have java path set properly on your machine. If not, please refer to my previous post on this Lay your Bed this Christmas. Remember to  direct all questions to me should you have any challenge following the steps.  I will be using Netbeans IDE (Integrated Development Environment) for this example, you can use any IDE you are comfortable  with to run this example. See list of possible IDEs and where to download them on this post Lay your Bed this Christmas.

Task: We will be writing a sample program to calculate the area of different basic shapes i.e. rectangle, square, circle etc..

Continue reading

Advertisements

Basic Java Keywords and syntax II

In my last post , we started looking at basic Java keywords and syntax. This post will take off from where we stopped as we will be discussing variables and its different forms/types and  identifiers.

Variable: A Java variable is a piece of memory that can contain a data value. Objects store their states in variables hence they are used as containers to hold values during the life cycle of an application. This can be any kind of information depending on the type of value the variable is holding. A variable can hold data ranging from texts(String), numbers(int,long), decimal numbers(double, float) and temporary results of multi step calculations etc.

Continue reading