用户登录
用户注册

分享至

getpassword什么意思

  • 作者: 经肛鉆
  • 来源: 51数据库
  • 2020-04-21

1.get与set方法详细解释publicStringgetPassword(){returnpassword;}

你前面应该定义了password这个字段并且为String类型的,类似这样: privateStringpassword; 其实getPassword()和setPassword()是对你定义的password进行取值和赋值, 这两个方法执行的顺序是这样的:首先执行 setPassword();//对password进行赋值; 当你要用到password中的值的时候调用 getPassword(); return返回的是当前password的值,而this指的是本类中的password(因为其他的类也可能定义了password如果其他类中有password并且是public的,此时你调用setPassword()这个方法时,那可能同时改了其他类的password)。

这样解释您应该明白了吧。

2.get password from this page什么意思

get password from this page

从本页获取密码

双语例句

1

Please be sure to get the password from your predecessors!

请务必向贵分会的前任干部索取密码!

2

A better approach is to pass a file name and get the passwordfrom that file, but in the interest of simplicity, I did not implementit.

更好的方法是传递一个文件名并从该文件中获得密码,但是为了保持简单性,我没有实现这种方法。

3.JAVA 中getpassword方法

我查了下API。

jdk1.5中有getPassword方法.

getPassword() 返回此 TextComponent 中所包含的文本。

getPassword

public char[] getPassword()返回此 TextComponent 中所包含的文本。如果基础文档为 null,则将给出 NullPointerException。为了取得较高的安全性,建议将每个字符设置为零以便在使用后清除返回的字符数组。

返回:文本

你可以查看API文档,上面说getText() 已过时。 从 Java 2 platform v1.2 开始,由 getPassword 来代替。

至于楼主所说的改成getPassword ()后就验证错误了,我想是因为返回值的原因。

可以这样做

String password= new String(jT_password.getPassword());

if ((jT_username.getText().equals(user))&& (password.equals(pwd))) {

System.out.println("success");

}

4.Password 是什么意思

password ['pɑ:sw?:d]

n. 口令

例句:

He is the very person that knows the password.

只有他知道密码。

New access-rights model for protect read- only translation unit via user group password.

新的访问权限模型用于经由用户组口令保护只读翻译单元。

And you need maybe a secret word or a secret number to get in, but we say a password, it's the word that lets you pass in, so you would need a password, which of course also might be anything.

(上网时)你可能还需要有一个秘密的单词或数字,我们称它们为“password”。有了秘码你才能进入网络,你可以选任何数字字母或词汇作为你的秘码。

5.

不好说,先看代码

new String(password.getPassword());

实例化一个String 对象,参数是password.getPassword()

如果password.getPassword() 返回类型是String,好说,照你的方式即可

password.getPassword().trim().equals("123456")

但是password.getPassword()有可能返回如byte[]等其他类型,那就需要转成String

如:password存在什么逻辑,getPassword()是非String类型的返回值

主要是password.getPassword()返回决定,因为不清楚password对象结构,只能如此分析

6.get与set方法详细解释

你前面应该定义了password这个字段并且为String 类型的,类似这样:

private String password;

其实getPassword()和setPassword()是对你定义的password进行取值和赋值,

这两个方法执行的顺序是这样的:首先执行

setPassword();//对password进行赋值;

当你要用到password中的值的时候调用

getPassword();

return 返回的是当前password的值,而this指的是本类中的password(因为其他的类也可能定义了password如果其他类中有password并且是public的,此时你调用setPassword()这个方法时,那可能同时改了其他类的password)。这样解释您应该明白了吧。

转载请注明出处51数据库 » getpassword什么意思

软件
前端设计
程序设计
Java相关