int32位 posted @ Sep 09, 2014 04:45:17 PM in java , 16041 阅读


import java.util.*;
public class ConsoleDemo {
    public static void main(String[] args) {
        Console console = System.console();
        if (console == null) {
            System.err.println("Failed to get console!");
        String name = console.readLine("Please type your name:");
        char[] password1 = null;
        char[] password2 = null;
        console.printf("Your name is %s\n", name);
        password1 = console.readPassword("Please type your password:");
        password2 = console.readPassword("Please type your password again:");
        if (!Arrays.equals(password1, password2)) {
            System.err.println("Password doesn't match the confirmation.");
        console.printf("Hi, %s, Your password is '%s'\n", name,  new String(password1));
        Arrays.fill(password1, '\0'); /* 安全清理 */
        Arrays.fill(password2, '\0');
  • 无匹配
  • 无匹配
AP 10th Social Model 说:
2022年9月10日 19:19

Social Study is most important students to all students of AP 10th Class, here we have provided the study material with solved question bank for all government and private school TM, EM, UM and HM students in chapter wise from past years old exams and we have provided the AP 10th Social Model Paper 2023 Pdf suggested by subject experts. AP 10th Social Model Paper All BSEAP 10th class regular and private course students can follow the list of chapters under SSC Social Study to practice study material with previous question bank to get a better score in summative assessment (SA) and formative assessment (FA) SA-1, SA-2, FA-1, FA-2, FA-3, FA-4 along with Assignments exams previously called Unit Test-1, Unit Test-2, Unit Test-3, Unit Test-4 and Three Months.

Alyssa 说:
2023年1月03日 19:51

There are a few ways to input a password in Java without having it echoed back to the console. One way is to use the class. This class provides methods for reading from selling real estate Riverside and writing to the console. To input a password, you can use the readPassword() method. This method reads a password from the console and returns it as an array of characters. Another way to input a password is to use the javax.swing.JOptionPane class. This class provides a method called showInputDialog() that can be used to input a password. This method returns the password as a string.

登录 *

loading captcha image...
or Ctrl+Enter