Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.tawakhal;
- /**
- *
- * @author Olgi Tawakhal <tawakhal95@gmail.com>
- */
- public interface File {
- public boolean cekFolder (String namaFolder, String path);
- }
- package com.tawakhal.api.src;
- import com.tawakhal.File;
- /**
- *
- * @author Olgi Tawakhal <tawakhal95@gmail.com>
- */
- public class FileImpl implements File {
- @Override
- public boolean cekFolder (String namaFolder, String path){
- String filePath = path + namaFolder;
- System.out.println("Folder dipangggil = "+filePath);
- java.io.File f = new java.io.File(filePath);
- return f.exists() && f.isDirectory();
- }
- }
- package example;
- /**
- *
- * @author Olgi Tawakhal <tawakhal95@gmail.com>
- */
- public class client {
- public static void main(String[] args) {
- atur();
- }
- public void atur(){
- String namaFolder = "tesFolder";
- String path = "F:/Tester/";
- com.tawakhal.File be = new com.tawakhal.api.src.FileImpl();
- boolean da = be.cekFolder(namaFolder, path);
- if (da){
- System.out.println("Folder sudah ada = "+namaFolder+" di path = "+path);
- }else{
- System.out.println("Folder tidak ditemukan");
- }
- }
- }
- package example;
- /**
- *
- * @author Olgi Tawakhal <tawakhal95@gmail.com>
- */
- public class client {
- public static void main(String[] args) {
- String namaFolder = "tesFolder";
- String path = "F:/Tester/";
- com.tawakhal.File be = new com.tawakhal.api.src.FileImpl();
- boolean da = be.cekFolder(namaFolder, path);
- if (da){
- System.out.println("Folder sudah ada = "+namaFolder+" di path = "+path);
- }else{
- System.out.println("Folder tidak ditemukan");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement