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

what is mean by (Baseline) JAVA0076 Use of magic number '6'
LVL 20
Sathish David  Kumar NArchitectAsked:
Who is Participating?
 
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 NArchitectAuthor 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.