if else java
if (condition) {
// statement
} else if(condition){
// statement
}else{
// statement
}
if else java
if (condition) {
// statement
} else if(condition){
// statement
}else{
// statement
}
for loop condition java
import java.util.Scanner;
public class Sample {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String usernames[] = { "jasmine", "Lyka", "marbie" };
String password[] = { "jasmine123", "lyka123", "marbie123" };
System.out.print("Enter Username: ");
String user = input.nextLine();
System.out.print("Enter Password: ");
String pass = input.nextLine();
boolean isExist = false;
for (int i = 0; i < password.length; i++) {
if (user.equals(usernames[i]) && pass.equals(password[i])) {
isExist = true;
break;
}
if (isExist = true) {
System.out.println("Welcome! " + user);
} else {
System.out.println("Account not Found!");
}
}
input.close();
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us