0

I am having a method

public double getNumberOfBooks(final int count, final double Price,
        final Long Quantity, final double totalValue)

Now I am calling this method from other java class as mentioned below

public void testgetNumberOfBooks()
{
    Long obj = Long.valueOf(5l);
    long val1 = obj.longValue();

    //long val = 100L;

    final double percentageDiscountComp = 
         testClass.getNumberOfBooks(10, 900.00d, val1, 1000.00d);

}

But not able to pass the value of Long in argument.It's giving error as The expression of type long is boxed into Long.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
Jhon
  • 27
  • 4
  • 1
    I am not getting this error in my IDE, maybe its just a warning message. Perhaps it is better to pass just the obj in the arguments why at all unbox it ? – Sikorski Feb 28 '17 at 07:15
  • It isn't an error. It is a warning, and you can ignore it / turn it off. However, there is a point to it. Namely you appear to have declare a parameter as `Long` that possibly ought to be `long`. Unless there is a good reason to use `Long`, then that is inefficient. – Stephen C Feb 28 '17 at 07:21

1 Answers1

0

No errors in intellij-idea. It might me settings of your Eclipse. Found similar error message in this question: The expression of type x is boxed into X?

Community
  • 1
  • 1
Dmitry Gorkovets
  • 2,208
  • 1
  • 10
  • 19