Browse Source

Commit

master
Cristobal 1 year ago
commit
c95e5202e3
12 changed files with 126 additions and 0 deletions
  1. +10
    -0
      .classpath
  2. +17
    -0
      .project
  3. +2
    -0
      .settings/org.eclipse.core.resources.prefs
  4. +14
    -0
      .settings/org.eclipse.jdt.core.prefs
  5. BIN
      bin/com/cristobalbernal/Proyecto_8_1/Main.class
  6. BIN
      bin/com/cristobalbernal/Proyecto_8_1/Persona.class
  7. BIN
      bin/com/cristobalbernal/Proyecto_8_1/package-info.class
  8. BIN
      bin/module-info.class
  9. +31
    -0
      src/com/cristobalbernal/Proyecto_8_1/Main.java
  10. +42
    -0
      src/com/cristobalbernal/Proyecto_8_1/Persona.java
  11. +1
    -0
      src/com/cristobalbernal/Proyecto_8_1/package-info.java
  12. +9
    -0
      src/module-info.java

+ 10
- 0
.classpath View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

+ 17
- 0
.project View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Proyecto_8_1</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

+ 2
- 0
.settings/org.eclipse.core.resources.prefs View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

+ 14
- 0
.settings/org.eclipse.jdt.core.prefs View File

@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17

BIN
bin/com/cristobalbernal/Proyecto_8_1/Main.class View File


BIN
bin/com/cristobalbernal/Proyecto_8_1/Persona.class View File


BIN
bin/com/cristobalbernal/Proyecto_8_1/package-info.class View File


BIN
bin/module-info.class View File


+ 31
- 0
src/com/cristobalbernal/Proyecto_8_1/Main.java View File

@ -0,0 +1,31 @@
package com.cristobalbernal.Proyecto_8_1;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
public class Main {
public static void main(String[] args)throws IOException {
File fichero = new File("C:\\Users\\crist\\Documents\\2DAM\\BaseDeDatos\\Personas.dat");
FileOutputStream fos = new FileOutputStream(fichero);
ObjectOutputStream oos = new ObjectOutputStream(fos);
ArrayList<Persona> personas = new ArrayList<>();
String[] nombres= {"Antonio","Perico","JuanJo","Joan"};
String[] apellidos = {"Pere","Caldero","Persiana","Martinez"};
int[] edades= {20,18,19,45};
oos.writeObject(nombres);
oos.writeObject(apellidos);
oos.writeObject(edades);
fos.close();
oos.close();
System.out.println("Se han creado los datos y guardado en el archivo correspondiente");
}
}

+ 42
- 0
src/com/cristobalbernal/Proyecto_8_1/Persona.java View File

@ -0,0 +1,42 @@
package com.cristobalbernal.Proyecto_8_1;
import java.io.Serializable;
public class Persona implements Serializable{
private String nombre;
private String apellido;
private int edad;
public Persona(String nombre,String apellido, int edad) {
this.nombre = nombre;
this.apellido = apellido;
this.edad= edad;
}
public Persona() {
this.nombre=null;
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public int getEdad() {
return edad;
}
public void setEdad(int edad) {
this.edad = edad;
}
}

+ 1
- 0
src/com/cristobalbernal/Proyecto_8_1/package-info.java View File

@ -0,0 +1 @@
package com.cristobalbernal.Proyecto_8_1;

+ 9
- 0
src/module-info.java View File

@ -0,0 +1,9 @@
/**
*
*/
/**
* @author crist
*
*/
module Proyecto_8_1 {
}

Loading…
Cancel
Save