[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

what is mean by (Baseline) JAVA0076 Use of magic number '6'

what is mean by (Baseline) JAVA0076 Use of magic number '6'
0
Sathish David  Kumar N
Asked:
Sathish David  Kumar N
  • 3
2 Solutions
 
objectsCommented:
instead of using values (6) in your code, define a constant and use that
theres an example in the link above
0
 
Sathish David Kumar NAuthor Commented:
>>>>>>However, because small integers are common, this rule does not apply to -5 thru 5.

why its not apply for thoes range?
0
 
cmalakarCommented:
>> why its not apply for thoes range

it is up to the programmer.

In general, magic number refers to use of numbers directly in source code.

Check out this..   http://en.wikipedia.org/wiki/Magic_number_(programming)
0
 
objectsCommented:
> why its not apply for thoes range?

because small numbers are used in a lot of places where you don't need to create constansts for them

eg.

for (int i=0; i<100; i+=2) {
    ...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now