小编use*_*501的帖子

新方法不起作用

我收到了一个错误

"非法表达和错误的开始';' 预期"

我不知道我是否正在使用新方法,所以请帮助我,我需要这个用于学校工作.

public class Testing{
    public static void main(String args[])throws IOException{

    String un, pw, login;
    final String Username = "javajava";
    final String Password = "testing";

    BufferedReader inpt = new BufferedReader (new InputStreamReader(System.in));

    public void Login(){
    System.out.println("Please enter your Username & Password for you to be able to use the program");
    System.out.println("Warning! Case Sensitive!");

        for(int trial=3; trial>=1; trial--){
            System.out.print("Username: ");
            un = inpt.readLine();

            System.out.print("Password: ");
            pw = inpt.readLine();

            System.out.println();
            if(un.equals(Username) && pw.equals(Password)){
                System.out.println("User has successfully logged in!");
                break;
            } …
Run Code Online (Sandbox Code Playgroud)

java methods function

-3
推荐指数
1
解决办法
81
查看次数

标签 统计

function ×1

java ×1

methods ×1