Editorial / Best Answer
abuthahir.d
Khadar , i tried this code . it gives that exception
for the foll reason :
when u give a CLA(command line argument) , it will be inserted in the index 0 of the array and then will proceed to 1 ,2 ....
so as per the question , "12345" will be at s[0] . and length of that aray will be 1when u try to access s[1] , we are trying for 2nd element which is unavailable.....
Hope this answers u :-)
Output of Java Program
class A
{
public static void main(String[] s)
{
System.out.println(s[1] + s[2] + s[3]);
}
}
java A 12345
Options
(i) 1
(ii) 12
(iii)1234
(iv)234
(v) Compilation Error
Profile Answers by khadarzone Questions by khadarzone
Questions by khadarzone answers by khadarzone
Editorial / Best Answer
abuthahir.dProfile Answers by abuthahir.d Questions by abuthahir.d
Khadar , i tried this code . it gives that exception
for the foll reason :
when u give a CLA(command line argument) , it will be inserted in the index 0 of the array and then will proceed to 1 ,2 ....
so as per the question , "12345" will be at s[0] . and length of that aray will be 1when u try to access s[1] , we are trying for 2nd element which is unavailable.....
Hope this answers u :-)
Related Answered Questions
Related Open Questions