• Post Reply Bookmark Topic Watch Topic
  • New Topic

String  RSS feed

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

when i run this code without passing commandline argument
it generates ArrayIndexOutOfBoundsException
but when i run the below pgm it generates compiletime error
variable might not have been initialized



what is the difference between the two..why the second pgm wont generate the same Exception
 
Marshal
Posts: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Get a pencil and paper, and go through the execution; at each line write down what the contents of the array a and the array ab are. That should tell you why you get whichever Exception or compiler error you are suffering.
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saravanan,

We believe in leading you to the answer.

Just try to think what the state of the object in question is at runtime
& it will lead you to the answer.

There are also rules about local variables you need to understand.
 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
saravanan ragunathan wrote:



Close attention to the program will give you an answer in a minute.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!