Write a Java program to demonstrate method overloading with overloaded methods that use different parameter types, including booleans and boolean arrays
class BooleanManipulator { String convertBoolean(boolean value) { return String.valueOf(value); } String convertBoolean(boolean[] values) { StringBuilder result = new StringBuilder(); for (boolean value : values) { result.append(String.valueOf(value)).append(" "); } return result.toString().trim(); } } public class Main { public static void main(String[] args) { BooleanManipulator manipulator = new BooleanManipulator(); System.out.println("Converted Boolean : " + manipulator.convertBoolean(true)); boolean[] boolArray = {true, false, true}; System.out.println("Converted Boolean Array : " + manipulator.convertBoolean(boolArray)); } }
Converted Boolean : true Converted Boolean Array : true false true
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions