|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Sep 2005
Messaggi: 37
|
[java] scrivere matrice su file
Ciao, vorrei Scrivere su un semplice file . txt, il contenuto della matrice macchine[][] che ho creato in questo file sottostante: qualcuno saprebbe darmi una dritta?
grazie! import java.util.Timer; import java.util.TimerTask; import java.io.*; public class Lavori { Timer timer; int x = 0; int v[]=new int[5]; static int macchine[][] = new int[101][6]; static int b=0; public void Reminder(int seconds) { timer = new Timer(); x= (int)Math.round(200*Math.random()); timer.schedule(new RemindTask(), x*100, seconds*100); } class RemindTask extends TimerTask { public void run() { int co= 0; int i=0; while ( i < 4 ) { v[i]= (int)Math.round(3*Math.random()); i++; } // fine while macchine[++b][0]=(b); macchine[b][1]=x; macchine[b][2]=v[0]; macchine[b][3]=v[1]; macchine[b][4]=v[2]; macchine[b][5]=v[3]; ++co; if (co==1) { timer.cancel(); } } // fine run } // fine remindtask } // fine crea |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Oct 2002
Città: Roma
Messaggi: 1502
|
Codice PHP:
__________________
Sun Certified Java Programmer EUCIP Core Level Certified European Certification of Informatics Professionals |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 12:18.



















