помогите новичку
Добавлено: 27 июл 2014, 13:28
В своем приложении создал класс, в котором планировал разместить методы для работы с файлами:
package alex.com.example.pfile;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStreamWriter;
//=======================================
public class MyClass {
public void CreateFile() {
try {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
openFileOutput("set",MODE_PRIVATE)));
bw.write("123456");
bw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
//============================================
Ошибка: MODE_PRIVATE cannot be resolved to a variable
Вместо этой константы ставлю 0 (что конечно некрасиво): openFileOutput("set",0)));
Новая ошибка: The method openFileOutput(String, int) is undefined for the type MyClass
Что надо сделать?
package alex.com.example.pfile;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStreamWriter;
//=======================================
public class MyClass {
public void CreateFile() {
try {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
openFileOutput("set",MODE_PRIVATE)));
bw.write("123456");
bw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
//============================================
Ошибка: MODE_PRIVATE cannot be resolved to a variable
Вместо этой константы ставлю 0 (что конечно некрасиво): openFileOutput("set",0)));
Новая ошибка: The method openFileOutput(String, int) is undefined for the type MyClass
Что надо сделать?