We can import Scanner from Java.utils.Scanner to pull in text entered in the console.
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String password = "";
do {
System.out.print("Enter your password: ");
password = sc.nextLine();
if(!password.equals("pals") {
System.out.println(\nIncorrect Password. Try again.");
}
} while(!password.equals("pals");
A syntax error can be a simple mistake as a typo or an extra space. A logical error has to do with the code structure, and if it makes sense.
Hope this helps!
Answer:
because producer can make their own food