Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

OCP Java SE 11 study guide question

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
The questions are about the study guide for OCP Oracle Certified Professional Java SE 11 by Jeanne Boyarsky and Scott Selikoff.

1) Default value for long
On p 53, the table shows that the default value for long is 0. However, the answer to the review question 8 on page 495 shows that the default value is 0L. When I tested with printing uninitialized class variables of type long and float, they defaulted to 0 and 0.0 respectively. Why is 0L the right answer to question 8 of Ch II review test then?

2) Changing numeric base
On p 68, first paragraph ends with saying that the latter four indicate a change of numeric base. However the first two in the list are decimal and octal - isn't octal also a change of numeric base compared to decimal? Shouldn't it then be 'the latter five'?

Thanks for any explanations!
I'm a beginner.

Kairi
 
Marshal
Posts: 67443
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

The question about 0/0L has come up here several times. One of the authors said it simply means that the default values are zero throughout rather that specifying the format of that 0 (64 bits rather than 32 bits). Look at this discussion..
 
Campbell Ritchie
Marshal
Posts: 67443
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kairi K├╝barsepp wrote:. . . On p 68, first paragraph . . .

Please quote the paragraph so those of us who don't have the book will know what it says.

I'm a beginner. . . .

In that case, a certification exam book is the wrong sort of book for you to buy. It assumes you already know a lot of programming.
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!