Monthly archives: May, 2018

Append a string into a string

just use ‘.=’ operator Example

Immutable Class in Java By Example

Immutable is a type of class that once created, its content can’t be change. To make  your class Immutable, you have to: Declare your Class as final. This is to prevent other class from extending. See Image#1 Properties must be declared as final. This is to prevent from setting their values after instantiation. See Image#2 …

Inheritance Example In Java

According to Oracle(R) docs, Inheritance. A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a superclass (also a base class or a parent class). The simplest example of this is the Student is a Person. In this example the Student class simply copies …

Day5 of #100DaysOfCode Challenge: Factory Pattern in Java

In programming, Factory Pattern can be describe as object builder and one of the best example for this is Vehicle Factory were we will build a vehicle according to ordered type. example: Step 1: Create your abstract Vehicle class and define its properties. You can also use Interface.

Step 2: Create Car vehicle class …

Day4 of #100DaysOfCode Challenge: Sorting the java.util.List

Sorting the items in the list is as simple as below example.

Output: AE G B AE C A — A AE AE B C G

Java is Both Pass-By-Reference and Pass-By-Value, However

Yes you heard that right, Java works on Pass-By-Reference and Pass-By-Value but there is a twist and this makes a lot of confusion. Before I start trying to prove that Java is both, lets start this by understanding these two concepts. Pass-By-Reference – the caller and callee shares the same variable. A good explanation from …