Which of the following data type you will prefer to store price - BigDecimal or Double ?
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. Which of the following data type you will prefer to store price - BigDecimal or Double ?
Ans. BigDecimal if memory and Performance is not critical concern, otherwise double.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   double   bigdecimal


Related Questions

  What is the difference between float and double?
 What is the difference between these two approaches of creating singleton Class ?

//Double Checked Locking Code
public static Singleton createInstance() {
   if(singleton == null){
      synchronized(Singleton.class) {
         if(singleton == null) {
            singleton = new Singleton();
         }
      }
   }
   return singleton;
}

//Single checked locking code
public static Singleton createInstance() {
   synchronized(Singleton.class) {
      if(singleton == null) {
         singleton = new Singleton();
      }
   }
   return singleton;
}
 Have you ever faced problems with rounding decimal places and what were the reasons ?
  Difference between DoubleSummaryStatistics , IntSummaryStatistics and LongSummaryStatistics ?
  Name few Double data types related classes and interfaces ?
  What is the size of double type ?
 Why calculations in float or Double sometimes gives unpredictable results ?
 What is the problem with this code

double x=10.04;
int a = x;
 What is a double ended queue?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: