0% found this document useful (0 votes)
3 views1 page

Import Java - Util.scanner

The document presents a Java class named LoginSystem that implements a simple authentication system. It includes a private constructor and a static method to authenticate users based on a hardcoded username and password. The main method prompts the user for their credentials and calls the authentication method to verify them.

Uploaded by

jipajex244
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Import Java - Util.scanner

The document presents a Java class named LoginSystem that implements a simple authentication system. It includes a private constructor and a static method to authenticate users based on a hardcoded username and password. The main method prompts the user for their credentials and calls the authentication method to verify them.

Uploaded by

jipajex244
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

import [Link].

Scanner;
class LoginSystem {
// Private constructor is fine
private LoginSystem() {}
// Your authentication logic
public static void authenticate(String username, String
password) {
if ([Link]("admin") && [Link]("1234"))
{
[Link]("Login Successful");
} else {
[Link]("Login Failed");
}
}
// MOVE THE MAIN METHOD HERE
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
// Most lab systems expect these prompt messages
[Link]("Enter Username: ");
String username = [Link]();
[Link]("Enter Password: ");
String password = [Link]();
// Call the method within the same class
authenticate(username, password);

[Link]();
}
}
// DELETE the "class Main" section entirely

You might also like