BRINGING THE PIECES TOGETHER II – Interface Declaration and Implementation

In my last post, we started bringing together the pieces of our previous tutorials together – we were able to set up our IDEs, created packages, classes, variables and Identifiers. In this post, we will continue from where we stopped which was the ShapeVariableBean.java class. Looking again at the structure of our application (AreaofShapes) as we discussed earlier here, we have three packages, nine (9) classes and one (1) interface altogether as shown below.

ProjectHeirachy2

In the last lesson, I explained the purpose of each package and we saw the content of ShapeVariableBean and how encapsulation came to play. Today, we will focus more on the com.bee.code.blog.ShapeController package and also, we will see how other classes implements interface within this package. In com.bee.code.blog.ShapeController package, the shapes are divided into two; PolygonController and NonpolygonController.

Note: As an update on the last post, I added a new item on this package which is what we will be focusing on today. I added interface AllShapesInterface above so we can see how to make use of an interface in the course of these set of lessons. Before we continue, please refer to my earlier post on interface where I explained in detail what an Interface is in case you missed the lesson.

Continue reading

Advertisements

JAVA OPERATOR II

As promised in my last post, I will be sharing sample codes showing how Java operators behave. I have named the Java classes in the sample codes after the operator class and I also added the result of each operation on the variables.

Sample Class showing Arithmetic Operations:

arithmeticOperators

Continue reading

Java Operators

Java operators are symbols used to command the computer to perform operations on operands. They follow either of the formats shown in the diagram below and are classified into eight different categories which includes Arithmetic, Relational, Logical, Unary, Bitwise and Bit Shift, Assignment Operators.

operator

Continue reading