Mi da errore , come posso istanziare nel MAIN "GestoreP"?
Facendo:codice:public class AccessoCont{ public class GestoreP{/*************** GESTORE P *********************/ private int sumPid; public GestoreP(){ } public void accediFile(int PID){ } }/*************** GESTORE P *********************/ public class Proc extends Thread{/****************** PROC *****************/ private GestoreP p; public Proc(GestoreP P, int pid){ super(""+pid); p = P; } @Override public void run(){ while(true){ p.accediFile(Integer.parseInt(this.getName()) ); } } }/******************************** PROC **********************************/ public static void main(String[] args){/************** MAIN ****************/ /* come istanziare un oggetto GestoreP ??? */ }/******************************** MAIN ********************************/ }
GestoreP gp = new GestoreP(); // mi dice che non posso perchè non è un ogg statico
Allora ho fatto:
AccessoCont ac = new AccessoCont();
GestoreP gp = new ac.GestoreP();
Come fare?
Grazie.

Rispondi quotando
