PDA

View Full Version : [Java]Illegal Start Of Type


Gjbob
15-02-2009, 10:31
package core;
import java.io.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class rOperation{
public final String dispPath = null;// "C://bRub/disp/bmagdb.db";
private String dbPath = null;
public void setdbPath(String newPath){
dbPath = newPath;}
File f = new File(dispPath);
try {
f.createNewFile();
}
catch (IOException ex) {
ex.printStackTrace();
}
}

Linea 11: Illegal start of type
Linea 14: Illegal start of type
Linea 15: ";" expected

Con questo codice ottengo questi errori eppure il cod. mi pare giusto; come mai?Sto utilizzando netbeans 6.5

agente mm8
15-02-2009, 10:51
public void setdbPath(String newPath){
dbPath = newPath;}
File f = new File(dispPath);
try {
f.createNewFile();
}
catch (IOException ex) {
ex.printStackTrace();
}

Gjbob
15-02-2009, 10:57
public void setdbPath(String newPath){
dbPath = newPath;}
File f = new File(dispPath);
try {
f.createNewFile();
}
catch (IOException ex) {
ex.printStackTrace();
}


?

ndakota
15-02-2009, 12:21
?

ha ragione, quelle righe non sono nel blocco di codice della funzione, della classe si, ma nulla pił, non credo fosse quello che volevi.