Advertisement
Guest User

Untitled

a guest
Apr 6th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. package lab1.pkg2;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Connector implements DBInterface {
  6.    
  7.     String address, userName, password;
  8.     boolean s = false;
  9.  
  10.     @Override
  11.     public boolean connect(String address, String userName, String password) {
  12.        
  13.         this.address = address;
  14.         this.userName = userName;
  15.         this.password = password;
  16.        
  17.            getName(1);
  18.            return s;
  19.     }
  20.  
  21.     @Override
  22.     public void disconnect() {
  23.         System.out.println("Disconnected");
  24.     }
  25.  
  26.     @Override
  27.     public boolean isConnected() {
  28.         Scanner sc = new Scanner(System.in);
  29.         while(s = true){
  30.             System.out.print("Continue? ");
  31.             int temp = sc.nextInt();
  32.            
  33.             if(temp == 1){
  34.                 s = true;
  35.             }else{
  36.                 s = false;
  37.                 break;
  38.             }
  39.         }
  40.         disconnect();
  41.         return false;
  42.     }
  43.  
  44.     @Override
  45.     public String getName(int id) {
  46.         if(userName == "dardan"){
  47.             s = true;
  48.             isConnected();
  49.         }
  50.         return userName;
  51.     }
  52.    
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement