The Proposal Line as an example is poorly thought out as close as it could be so it would be an Arrangement of String
String[][] personas = new String[][]
{ {"12345678","Nombre1 Apellido1","2016/10/12"},
{"99999999","Nombre2 Apellido2","2015/10/12"}
};
For such task I propose to use clases
with the respective attributes that it raises detail a basic example, to try and create Objects
public class Person {
/* Atributos */
private String dni;
private String nombre;
private String apellido;
private String fecha;
/* Contructores */
public Person() {
}
public Person(String dni, String nombre, String apellido, String fecha) {
this.dni = dni;
this.nombre = nombre;
this.apellido = apellido;
this.fecha = fecha;
}
/* Aquí irían sus getter y setters */
/* Método toString */
public String toString() {
/* \n para el salto de línea y toUpperCase() para mostrar en mayúsculas */
return "DNI : " +dni +"\n"+
"Nombre : "+ nombre.toUpperCase() +"\n"+
"Apellido : "+ apellido.toUpperCase() +"\n"+
"Fecha : " +fecha+"\n";
}
In your Main class, you should create a arreglo
of Objects of type Person
and the impression would be by a for
of objects by calling the method toString();
public static void main(String[] args) {
Person[] personas = new Person[2]; /* Arreglo de Objetos*/
/* Llamo al Constructor con Parametros */
personas[0]= new Person("12345678", "nombre1", "apellido1", "2014/12/12");
personas[1]= new Person("98765432", "nombre2", "apellido2", "2014/02/06");
for (Person persona : personas) {
/* LLamamos al Método toString(); de la clase Person*/
System.out.println(persona.toString());
}
}