简体   繁体   English

NetBeans中的Java编码

[英]java coding in netbeans

The following code written in netbeans it shows error as cannot find length() method and invert if.im new to netbeans. 以下用netbeans编写的代码显示错误,因为找不到length()方法并反转了netbeans新的if.im。 please correct my code.thanks in advance. 请更正我的代码。谢谢。

 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
       if(jTextField1.getText().trim().length() == 0 && jPasswordField1.getPassword().length() == 0)

getPassword() returns char[] so use .length field getPassword()返回char[]因此请使用.length字段

jPasswordField1.getPassword().length

Also See 另请参阅

Try 尝试

jPasswordField1.getPassword().length

getPassword() returns char[] . getPassword()返回char[] See docs . 参见docs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM