[Solved] a constructor having 2 parameters


As you have created an instance of the class Bachcha in your main method, you can use that instance to access the methods.

String n = System.console().readLine("enter name");
String g = System.console().readLine("enter gender");
Bachcha b = new Bachcha(n, g);

b.getName();
b.getGender();

solved a constructor having 2 parameters