I have a small code in which the purpose is to verify the user's name and see if it exists in an array and the age verify if it is of legal age. If it is, you are authorized to enter the system.
The code is not finished yet but my doubt is that I have a String
method that receives a parameter called name
that is in another class and is inherited through the main class called MyName
I have two Defined fields private
(should define them or public because the method of the other class will use them), well then in the main class I define a constructor by which define (start) by default the values there is my other problem I have two objects an object type String and another type ID the beria define asi like as?
Here is the code to see what I have:
Main class
/*Proposito del programa:
el proposito del programa es verificar el name del usuario y ver si exsite en un array y la edad
verificar si es mayor de edad si lo es es autorizado a entrar al sistema.
*/
public Class MyClass extends Methods {
public static void main(String[]args) {
//Campos
private String name;
private int edad;
//Creo los objetos name(nombre) y edad(la edad del usuario)
String user = new String();
id edad = new id();
/* Mi problema es aqui en los objetos deberia crearlos asi o como ?*/
//Constructor
public MyClass {
user.Getname = "Gilberto quintero";
}
Scanner entrada = new Scanner(System.in);
}
}
The other class
public Class Methods {
public String Getname(String name) {
System.out.println("Hola bienvenido a"+name);
}
}