Java Program to Demonstrate How User Authentication is Done Last Updated : 04 Nov, 2020 Comments Improve Suggest changes Like Article Like Report Authentication is the process of verifying the identity of users or information. User authentication is the process of verifying the identity of the user when that user logs in to a computer system. The main objective of authentication is to allow authorized users to access the computer and to deny access to unauthorized users. Example Default Assumption: User name = Geeks For Geeks , Password = Geeks For Geeks Input: User name = Geeks For Geeks, Password = Geeks For Geeks Output: Authentication Successful Input: User name = Geeks For Geeks, Password = Hello world Output: User name/ Password not matching Approach Take username and password as string input from the user.Check if the username matches the password or not.If it matches then welcome the user.Else display an appropriate message.Below is the implementation of the above approach Java // Java program to check the authentication of the user // Importing the modules import java.util.*; // Gfg Class public class Gfg { // Main CLass public static void main(String args[]) { // Declaring the username and password String user_name = "Geeks For Geeks"; String password = "Geeks For Geeks"; // Checking the validity of the input if(user_name.equals("Geeks For Geeks") && password.equals("Geeks For Geeks")) { // Printing Output System.out.println("Authentication Successful"); } else { // Printing Output System.out.println("User name/ Password not matching"); } } } OutputAuthentication Successful Comment More infoAdvertise with us Next Article Java Program to Demonstrate How User Authentication is Done A aditya_taparia Follow Improve Article Tags : Java Java Programs Practice Tags : Java Similar Reads Java Program to Encrypt Password in Configuration Files Passwords provide the first line of defense against unauthorized access to your computer and personal information. The stronger your password, the more protected your computer will be from hackers and malicious software. Every website or software application requires a password in order to authentic 6 min read Java Program to Get Connected to a Web Server In today's interconnected world, connecting to web servers is a fundamental skill for software developers. Whether you're building a web application that needs to fetch data from external sources, testing a web service, or even performing web scraping for research, knowing how to interact with web s 4 min read How to Secure Communication Using SSL/TLS in Java? Secure Sockets Layer (SSL) or Transport Layer Security (TLS) are cryptographic protocols designed to provide secure communication over the computer network. These protocols are establish an encrypted connection between the client and the server, make sure that the data exchanged between them remains 5 min read Java Networking Programs - Basic to Advanced Java allows developers to create applications that can communicate over networks, connecting devices and systems together. Whether you're learning about basic connections or diving into more advanced topics like client-server applications, Java provides the tools and libraries you need. This Java Ne 3 min read Java Programs - Java Programming Examples In this article, we will learn and prepare for Interviews using Java Programming Examples. From basic Java programs like the Fibonacci series, Prime numbers, Factorial numbers, and Palindrome numbers to advanced Java programs.Java is one of the most popular programming languages today because of its 8 min read Like