long AccountNumber = 1234567890;
public void setAccNum(long Number)
try(the size of the account number is lesser than equal to 10){
this.Accountnumber = Number;
}
catch(Exception e){
System.out.println("Error: Invalid account number");
}
In the above code, to validate the length of the account number, is there any function to find the length of the value in AccountNumber variable in Java?