java - Why is the compiler giving me an error with writeInt? -


i making dat file 3 int numbers when use writeint write the compiler gives me error on writeint, have do.

import java.io.*;   public class esercizio010916 {       public static void main(string[] args) {          string path ="c:\\users\\enzo\\documents\\compiti informatica\\esercizi\\corso di recupero 2016\\esercizio 01.09.16\\";          string nomedat = "quantità.dat";          string nomecsv = "oggetti.csv";          string pathdat = path + nomedat;          string pathcsv = path + nomecsv;          creadat(pathdat);     }      public static void creadat(string pathdat){        int n1;         int n2;         int n3;          try{              fileinputstream filefisico = new fileinputstream(pathdat);              datainputstream filelogico = new datainputstream(filefisico);              n1 = console.readint("inserisci il valore di n1 \n");              n2 = console.readint("inserisci il valore di n2 \n");              n3 = console.readint("inserisci il valore di n3 \n");              filelogico.writeint(n1);               filelogico.close();          }catch(ioexception e){              system.out.println("ioexception e");          }      } } 

change datainputstream dataoutputstream.

the output-stream classes used program write bytes (like file, console, etc.), while input-stream ones used reading (file, console, etc).

of course, you'll have change fileinputstream fileoutputstream, also.


Comments