wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes MasterExam LAb Question (modified) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "MasterExam LAb Question (modified)" Watch "MasterExam LAb Question (modified)" New topic
Author

MasterExam LAb Question (modified)

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634




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 ?


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

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!


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

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

Joined: Nov 04, 2009
Posts: 2066

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

Joined: May 18, 2010
Posts: 634



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

Joined: Nov 04, 2009
Posts: 2066

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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MasterExam LAb Question (modified)