• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Bugtraking Devaka's Examlab

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 537
Eclipse IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 7402
1423
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 7402
1423
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
reply
    Bookmark Topic Watch Topic
  • New Topic