Vale, lo arreglé. Dejo el codigo.
Código Java:
Ver original try {
File fichero
= new File("camiones.obj"); System.
out.
println("Introduce un codigo: "); int codigo = sc.nextInt();
while (true) {
Camiones camion = (Camiones) ois.readObject();
if(codigo == camion.getNumero_registro()){
System.
out.
printf("%-20s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s\n",
"Numero registro",
"Marca",
"Modelo",
"Color",
"Fecha Fab.",
"Kilometros",
"Tara",
"Carga max.",
"Num. Ruedas",
"Precio",
"Observaciones"); System.
out.
printf("%-20s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s\n",
"===============",
"=====",
"======",
"=====",
"==========",
"==========",
"====",
"==========",
"===========",
"======",
"============="); System.
out.
printf("%-20s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s\n", camion.
getNumero_registro(), camion.
getMarca(), camion.
getModelo(), camion.
getColor_carroceria(),
camion.getFecha_fabricacion(), camion.getKilometros(), camion.getTara(), camion.getCarga_maxima(), camion.getNumero_ruedas(),
camion.getPrecio(), camion.getObservaciones());
System.
out.
println("-----------------"); }
}
//io.printStackTrace();
} finally {
ois.close();
}
}