Quote:
Originally Posted by bankkab
here this code
class Connect extends MainScreen {
Connect() {
FileConnection fc = null;
String fileContent = "";
try {
fc = (FileConnection)Connector.open("file:///D:/IP.txt");
if ( (fc==null) || !fc.exists()){
return "File does not exist";
}
InputStream in = fc.openInputStream();
byte[] data = IOUtilities.streamToBytes(in);
fileContent = new String(data);
in.close();
fc.close();
} catch (Throwable t) {
}
return fileContent;
}
}
it error " cannot return a value from method whose result type is void "
where is a void i don't declare a void function
|
Since your method returns String, so you need to have the method declaration accordingly, i.e.,
String Connect() { //instead of Connect() {