به نام خدا
سلام من درحال یادگیری جاوا هستم و الان به مشکل برخوردم امیدوارم کمکم کنید
مثلا در کد زیر
import java.util.Scanner;
class Project {
public static void main(String[] args) {
Scanner passwordInput = new Scanner(System.in);
System.out.print("Please enter your password: ");
int builltInPassword = 2244176;
if (passwordInput.hasNextInt() && passwordInput.nextInt() == builltInPassword) {
System.out.println("Thanks, you entered the right format" + " \nand also your password is correct");
} else {
System.out.println("Sorry, please enter the right format" + " \nor the right password");
}
}
}
1: کاربرد has چیست و چه کاری انجام داده و چه لزومی دارد از ان استفاده شود
2: اگر بخواهیم یک اسکنر دیگر با نام یوزر بسازیم و کاربر فقط مجاز به استفاده از حروف باشد، چه متغیری باید تعریف کنیم؟
متشکرم