Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- public class Profecia {
- File arquivo = new File("D:\\teste.txt");
- String novo[] = new String[10];
- public void verifica_existe() {
- if (!arquivo.exists()) {
- System.out.println("não existe");
- }else{
- System.out.println("existe");
- }
- }
- public boolean deleta() {
- arquivo.delete();
- if (!arquivo.delete()) {
- return true;
- }
- return false;
- }
- public void dados_arquivo() {
- novo[0] = arquivo.getPath();
- novo[1] = arquivo.getName();
- }
- public void mostra(){
- System.out.println(novo[0]+"\n"+novo[1]+"\n"+arquivo.length());
- }
- }
- public class Mostra {
- public static void main(String[] args) {
- Profecia n=new Profecia();
- n.verifica_existe();
- n.dados_arquivo();
- n.mostra();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement