About Question enthuware.ocajp.i.v7.2.1405 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
naziat
Posts: 4
Joined: Tue May 15, 2018 6:44 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1405 :

Post by naziat »

Again my question remains unanswered.

According to my understanding, there will be 4 objects (excluding String[] args)
1) One object created for first Noobs object
2) Second object created of MyException by above first Noobs object
3) Third object created for second Noobs object
4) Fourth object created of MyException by above second Noobs object

But what makes you say that its 6 objects actually?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1405 :

Post by admin »

That is what the first line of the explanation also says, "When a Noobs object is created, a MyException object is also created. Therefore a total of 4 objects are created. "

Regarding 6 objects, did you read my reply above (to Sai Diyva Sri)? It contains a link. You need to read that article to understand that 2 class objects are also created. That makes it 4+2 = 6 objects. But that is not required for the OCAJP exam.
If you like our products and services, please help us by posting your review here.

patricklm
Posts: 1
Joined: Thu Jan 02, 2020 5:27 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1405 :

Post by patricklm »

Debugging this question on IntelliJ shows the following objects being created in the following order:
1) Noobs@792
2) MyException@7954
3) String[0]@795
4) Noobs@796
5) MyException@797

Does this question exclude the String[], the main method argument?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1405 :

Post by admin »

Please check the explanation shown for this question. It explains the point that you have raised:
Note: Some candidates have reported getting a similar question.
The question is ambiguous because two Class objects (one for Noobs and one for MyException) are also created. If you consider those, then the answer would be 6. A String array object pointed to by args is also created and if you consider that, the answer would by 7. Further, several Thread objects are also created (although not directly by this code.) Since this is out of scope for the exam, it is best to ignore these kind of objects and consider only the objects created directly by the code.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests