int a ; booleanb=true ; double c , f ; String d ; DataOutputStreamout=newDataOutputStream( newFileOutputStream("dict.dic")); Scannercin=newScanner(System.in);
for (inti=0 ; i < 5 ; i ++ ) { a = cin.nextInt() ; f = Math.random() ; if ( f > 0.5 ) b = true ; else b = false ; c = cin.nextDouble() ; d = cin.next() ; out.writeInt(a); out.writeBoolean(b); out.writeDouble(c); out.writeUTF(d); }
inta=0; booleanb=false; doublec=0; Stringd=null; for (inti=1; i <= n; i++) { a = file.readInt(); b = file.readBoolean(); c = file.readDouble(); d = file.readUTF(); } System.out.print(a + "\n" + b + "\n" + c + "\n" + d); } }