Using full words as variables for login system [closed]

坚强是说给别人听的谎言 提交于 2019-12-31 07:43:06

问题


I'm creating a login system that currently uses hard coded integers for a UserID, password and Student number which means they are all numbers. What would I use to be able to make the integers (the UserID and password) words instead of numbers? This is how it currently looks;

public static void main(String[] args) {

    final int UserID = 5555; 
    final int Password = 1234;
    final int StudentNumber = 22334455;

回答1:


    final int UserID = 5555; 
    final int Password = 1234;
    final int StudentNumber = 22334455;
String UserID_str = String.valueOf(UserID);
String Password_str = String.valueOf(Password);
String StudentNumber_str = String.valueOf(StudentNumber);



回答2:


To convert integers to Strings you can use .toString()

final String UserID = new Integer(5555).toString(); 
final String Password = new Integer(1234).toString();
final String StudentNumber = new Integer(22334455).toString();


来源:https://stackoverflow.com/questions/22662566/using-full-words-as-variables-for-login-system

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!