• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MasterExam LAb Question (modified)

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



after adding the line below at line 7(in comments),Exception occurs at runtime


1.why is there a Exception ??

3.is it possible to synchronize the above on this instead of finishedWidgets ?

2.can i replace finishedWidgets with this at line 3,4,5 ?

 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohitkumar gupta wrote:
after adding the line below at line 7(in comments),Exception occurs at runtime


1.why is there a Exception ??

What is the Exception? What does the compiler say? TellTheDetails Please!
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abimaran Kugathasan

Here the Exception


Exception in thread "Moe" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
Curly got a widget

hurry
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.remove(Unknown Source)
at WidgetMaker.waitForWidget(WidgetUser.java:23)
at WidgetUser.run(WidgetUser.java:34)
Exception in thread "Lenny" java.lang.IndexOutOfBoundsException: Index: 0, Size:
0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.remove(Unknown Source)
at WidgetMaker.waitForWidget(WidgetUser.java:23)
at WidgetUser.run(WidgetUser.java:34)
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, use proper indentation in your codes, otherwise, you won't get the response. This is said many times. Check the below code snaps!

Problem is, you don't populate the List enough. Now, try to run. Again, Use proper indentation!
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Abimaran wrote:
Problem is, you don't populate the List enough


if i uncomment the line 7,then program runs fine
then,there is no need to populate list

how that's possible then ?

i would keep in mind the indentation..
i didn't knew what indentation was ??
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohitkumar gupta wrote:
if i uncomment the line 7,then program runs fine
then,there is no need to populate list

First, did you run my code? Have a look on the exception thrown. IndexOutOfBoundsException?

mohitkumar gupta wrote:
i would keep in mind the indentation..
i didn't knew what indentation was ??

The difference between the first post and last post!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic