Hi i am learning java for past few days only when i try to execute a simple program i got an ArrayIndexoutofbounds exception during run time pls help me to fix this exception
here is my code
class Armstrong
{
public static void main(String args[])
{
if (args.length!=0) {
System.out.println("value is required");
System.exit(0);
}
int num = Integer.parseInt(args[0]);
int n = num;
int check =0, remainder;
while(num>0)
{
remainder = num%10;
check = check+(int)Math.pow(remainder,3);
num = num/10;
}
if (check==n)
System.out.println(n+ "isa armstrong number");
else
System.out.println(n + "is not a armstrong number");
}
}