link:http://soft.chinabyte.com/database/191/12466191.shtml
从键盘读入,并输出,中间用到了set和get方法
public static void main(String[] args) throws IOException {
String sname,spwd;
Scanner sc = new Scanner(System.in);
System.out.println("please enter your name:");
sname = sc.nextLine();
System.out.println("please enter your pwd:");
spwd = sc.nextLine();
ftp_base fb = new ftp_base();
fb.setUsrname(sname);
fb.setPwd(spwd);
System.out.println("your name is" + " " + fb.getUsrname() + " " + " and your pwd is" + " " + fb.getPwd());
}
run: