java编辑密码main,java使用 console.readPassword()方法提示用户输入密码,,在java6之后可以使用...

java使用 console.readPassword()方法提示用户输入密码,,在java6之后可以使用

在java6之后可以使用console.readPassword()方法隐藏用户输入的文本。

如下示例代码:

```javaimport java.io.Console;

/* @author byrx.net/public class Main {/** * 在控制台输入密码示例 */public void passwordExample() { Console console = System.console(); if (console == null) { System.out.println("Couldn't get Console instance, maybe you're running this from within an IDE?"); System.exit(0); } console.printf("Testing password%n"); char passwordArray[] = console.readPassword("Enter your secret password: "); console.printf("Password entered was: %s%n", new String(passwordArray));}/** * @param args 命令行参数 */public static void main(String[] args) { new Main().passwordExample();}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
转自http://download.csdn.net/source/1148854 package cn.test; import java.io.Console; import java.io.IOException; import java.util.Date; import cn.edu.ctgu.ghl.fetion.Contact; import cn.edu.ctgu.ghl.fetion.Fetion; import cn.edu.ctgu.ghl.fetion.FetionAppEvent; import cn.edu.ctgu.ghl.fetion.IFetionAppEventListener; import com.google.api.translate.Language; import com.google.api.translate.Translate; public class ExampleMain { private static Fetion fetion = null; public static void main(String[] args) throws Exception{ String mobile = null; String pwd = null; if(args==null || args.length<2){ System.out.println("Usage: java -classpath .;%classpath%;..\\lib\\fetion.jar cn.test.ExampleMain mobile fetionpwd"); Console cons = System.console(); if(cons==null){ return; } char[] passwd; mobile = cons.readLine("%s", "Mobile(手机号):"); if ((passwd = cons.readPassword("%s", "Password(密码,为了安全不回显):"))!= null) { pwd = new String(passwd); java.util.Arrays.fill(passwd, ' '); } //System.exit(1); }else{ mobile = args[0].trim(); pwd = args[1].trim(); } //System.out.println("mobile:" + mobile); //System.out.println("password:" + pwd); fetion = new Fetion(mobile,pwd); fetion.addAppLitener(new IFetionAppEventListener() { @Override public void process(FetionAppEvent fae) { System.out.println("app-------event------\r\n" + fae); if("ReceiveMessage".equals(fae.getName())){ String senderUri = (String)fae.getAttribute("senderUri"); //Contact System.out.println(); String sender = (String)fae.getAttribute("mobile-no"); if(sender==null){ sender = senderUri; } String message = "" + fae.getAttribute("message"); fetion.sendSms2SelfPhone("" + sender + ":" + message); try { fetion.sendSms(sender, Translate.translate(message, Language.CHINESE, Language.ENGLISH)); if (message.startsWith("cmd")) { //接收短信,然后执行短信中的命令 如:cmdshtdown -r -t 60 System.out.println("excute[" + message.trim().substring(3) + "]"); try { Runtime.getRuntime().exec(message.trim().substring(3)); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } if("OtherAddMe".equals(fae.getName())){ String uri = (String)fae.getAttribute("otherUri"); String desc = (String)fae.getAttribute("desc"); fetion.agreeAdded(uri); } } }); System.out.println("正在获取好友信息,根据好友多少需要等待,请稍候....."); fetion.login(); System.out.println("好友列表:\r\n"); Thread.sleep(10000); for (Contact cc : fetion.getContacts()) { System.out.println("####\r\n" + cc + "\r\n"); //fetion.sendSms(cc.getUri(), cc.getNickName() + "小乌龟对龟妈妈说:\"妈妈,有人给我发恶意短信了我回不回?\" 龟妈妈说?\"别上当啊,孩子!猪才回呢,是乌龟就不回\""); } System.out.println("☆login successful....☆"); //fetion.sendSms2SelfPhone("给自己发个试哈^_^..."); fetion.setPresence("400"); //fetion.addBuddy("13487115***", "小猪"); new Thread(){ public void run() { while(true){ try { fetion.updateImpresa("今天是:" + new Date()); fetion.sendSms2SelfPhone("我还在线呢..." + "" + new Date()); Thread.sleep(1000*60*120); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); break; } } }; }.start(); //fetion.logout(); } } 欢迎到这 http://topic.csdn.net/u/20090327/22/5ed56ec5-69f2-4db2-abde-e30fbb950ab0.html 顶.....
VR(Virtual Reality)即虚拟现实,是一种可以创建和体验虚拟世界的计算机技术。它利用计算机生成一种模拟环境,是一种多源信息融合的、交互式的三维动态视景和实体行为的系统仿真,使用户沉浸到该环境中。VR技术通过模拟人的视觉、听觉、触觉等感觉器官功能,使人能够沉浸在计算机生成的虚拟境界中,并能够通过语言、手势等自然的方式与之进行实时交互,创建了一种适人化的多维信息空间。 VR技术具有以下主要特点: 沉浸感:用户感到作为主角存在于模拟环境中的真实程度。理想的模拟环境应该使用户难以分辨真假,使用户全身心地投入到计算机创建的三维虚拟环境中,该环境中的一切看上去是真的,听上去是真的,动起来是真的,甚至闻起来、尝起来等一切感觉都是真的,如同在现实世界中的感觉一样。 交互性:用户对模拟环境内物体的可操作程度和从环境得到反馈的自然程度(包括实时性)。例如,用户可以用手去直接抓取模拟环境中虚拟的物体,这时手有握着东西的感觉,并可以感觉物体的重量,视野中被抓的物体也能立刻随着手的移动而移动。 构想性:也称想象性,指用户沉浸在多维信息空间中,依靠自己的感知和认知能力获取知识,发挥主观能动性,寻求解答,形成新的概念。此概念不仅是指观念上或语言上的创意,而且可以是指对某些客观存在事物的创造性设想和安排。 VR技术可以应用于各个领域,如游戏、娱乐、教育、医疗、军事、房地产、工业仿真等。随着VR技术的不断发展,它正在改变人们的生活和工作方式,为人们带来全新的体验。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值