Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bugtraking Devaka's Examlab

 
Anastasia Sirotenko
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was working through 2nd exam round in Devaka's ExamLab (great software, i rely upon it to clear my future exam), found this bug in 27 question:


the answer is definitly should be something like " Boolean.parseBoolean(String) returns boolean value, not Boolean object, so you cannot call a getClass() method on boolean value"
 
Anastasia Sirotenko
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And one more may-be-bug (or i messed somewhere in my code and cannot find where)
The answer in ExamLab is:

But i ran the code:

ra1 = (Runnable[])ca; is defenetly compiles fine, it´s the same case as A[] aa2 = (A[])ra1; if i am not wrong.

PS My bad, i did not notice final modifier for class C, Devaka's code is good (tho evil!), surely now i will take more attention in future for such things, really great simulator 8)
 
Ankit Garg
Sheriff
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anastasia Sirotenko wrote:the answer is definitly should be something like " Boolean.parseBoolean(String) returns boolean value, not Boolean object, so you cannot call a getClass() method on boolean value"


Check the java.lang.Boolean class documentation. There is no parseBoolean method in it.

In your second code, you missed final before the class C...
 
Nitish Bangera
Ranch Hand
Posts: 537
Eclipse IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit parseBoolean is definitely there in the Boolean wrapper which gives out a boolean. Also it is case insensitive. The correct answer will be yes the primitive value cannot get a class. Well as for the second one, before casting think you apply a instanceof well instanceof is like on the right side there can be any interface but on the left of the instanceof there should be a non final class. Well same applies here. And if arrays are there then nonfinal class array instance of interface array >---->(Interface array)non final class array and not (Interface array)non final class. I guess this was there in the examlab.
 
Anastasia Sirotenko
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:
Anastasia Sirotenko wrote:the answer is definitly should be something like " Boolean.parseBoolean(String) returns boolean value, not Boolean object, so you cannot call a getClass() method on boolean value"

Check the java.lang.Boolean class documentation. There is no parseBoolean method in it.

http://java.sun.com/javase/6/docs/api/java/lang/Boolean.html#parseBoolean(java.lang.String) here it is...


Ankit Garg wrote:your second code, you missed final before the class C...

Thank you very much! Here i get it 8)
It's not a Devaka's mistake, but mine here 8)
 
Anastasia Sirotenko
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitish Bangera wrote:Well as for the second one, before casting think you apply a instanceof well instanceof is like on the right side there can be any interface but on the left of the instanceof there should be a non final class. Well same applies here. And if arrays are there then nonfinal class array instance of interface array >---->(Interface array)non final class array and not (Interface array)non final class. I guess this was there in the examlab.

Yes, i was mistaken with this final class, did not notice it, thank you 8)
 
Ankit Garg
Sheriff
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitish Bangera wrote:Ankit parseBoolean is definitely there in the Boolean wrapper which gives out a boolean.


I messed up
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitish Bangera wrote:Ankit parseBoolean is definitely there in the Boolean wrapper which gives out a boolean.


So there is a bug in K&B book (rhyme )
Page 243 - parseBoolean is not marked.
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4252
227
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for noticing. The first one is an error with the explanation, and it is already discovered before. - Will be fixed with the next update

Devaka.
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4252
227
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anastasia,

What is the screen resolution you are using there?
The appearance of the "Copy Program" button in your screenshot makes me confused.
 
Nitish Bangera
Ranch Hand
Posts: 537
Eclipse IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope you put the description for the formatter questions also. Little better than pointing to J2SE documention.
 
Anastasia Sirotenko
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Devaka Cooray wrote:Anastasia,

What is the screen resolution you are using there?
The appearance of the "Copy Program" button in your screenshot makes me confused.


I am using 1280x1024 resolution. Realy did not pay attention how things look 8)
Great training software, Devaka, thank you for that!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic