IF ELSE USE IN JAVA.THIS IS THE WAY TO USE IF ELSE IN JAVA.
SIMPLE YOU CAN USE IF{}ELSE{} IN JAVA LIKE THIS:
CODE IS:
import java.util.Scanner;
public class Demo
{
public static void main(String args[])
{
String username;
Scanner sc = new Scanner(System.in);
System.out.print("Enter Username :");
username = sc.nextLine();
if(username.equals("Admin"))
{
System.out.print("pass");
}
else
{
System.out.print("Failed");
}
}
}
SIMPLE YOU CAN USE IF{}ELSE{} IN JAVA LIKE THIS:
CODE IS:
import java.util.Scanner;
public class Demo
{
public static void main(String args[])
{
String username;
Scanner sc = new Scanner(System.in);
System.out.print("Enter Username :");
username = sc.nextLine();
if(username.equals("Admin"))
{
System.out.print("pass");
}
else
{
System.out.print("Failed");
}
}
}
THIS THE WAY TO YOU CAN USE IF ELSE IN JAVA.
Comments
Post a Comment