02: OOP vs FP with Java example – Conversion strategy pattern

Java code to convert given input values from KM to Meter, Meter to Centimetres, etc. OOP approach using the strategy design pattern Step 1: Define an interface.

Step 2: Define a generic “MyMetricConverter” that implements the “Converter”.


300+ Java Developer Interview Q&As

800+ Java Interview Q&As