• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Another Dan's erroneous definition?

 
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is from comprehensive exam 10:


Question 17
Which of the class instance creation expressions would produce a run-time error?
a. Long.parseLong("1")
b. Long.parseLong("1L")
c. Long.parseLong("010")
d. Long.parseLong("0x10")
e. Long.parseLong("1.0")


There are no class instance creation expressions in this question. If it were valueOf(String str), then probably yes.
 
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree that no instance creation can be inferred from reading the API for Long.parseLong
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I even looked at the code and there is no instance creation except for instantiation of a NumberFormatException if the String contains non-numeric data.
 
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vad Fogel:
There are no class instance creation expressions in this question. If it were valueOf(String str), then probably yes.


You are correct. They are obviously method invocation expressions. If you see any more of those types of errors, the please let me know.
 
Did Steve tell you that? Fuh - Steve. Just look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic