Very good to the whole community I am new and eager to learn in java. Well my doubt lies in the literal b, my code I have it this way.
In a class called Person you have two methods and one variable, the variable is called typeBaile and is private. to. The first method is public and it will be called dancing and will have a parameter, the function of This will show on the screen the message "I dance" and concatenate the variable that will receive in the parameter which will be captured from the keyboard. Example of the message "I dance salsa" b. The second method must be private and its function will be to capture the value of the variable. c. Create a default constructor that initializes the variable typeBaile="sauce" and that invoke the dance method. d. Create a custom constructor so that it receives as parameter the variable of the class. Create the class that contains the main method and invoke the methods.
import java.util.*;
class persona(){
private String tipoBaile;
public void bailar(String genero){
System.out.println("yo bailo"+genero);
}
private void bailar(){
System.out.println();
}
public persona(){
tipoBaile="salsa";
bailar(tipoBaile);
}
public persona(String tipoBaile){
this.tipoBaile=tipoBaile;
}
}
class Demopersona{
public static void main(String[]HD){
persona per1 = new persona();
}
}
I'm working with builders as you can see. I do not know if I'm wrong and I hope they correct me.