how to create custom exception with a number in constructor in Java -


if create custom exception string message have: super(message) however, want have double number in exception message. constructor myexception: message:90.6. throw exception: throw new myexception("my message", 90.6);

here code i've tried didnt works. appreciate.

public class myexception extends exception {      private string message;      private double qtyavail;      public myexception(string message, double qtyavail){          super(message);          this.qtyavail = qtyavail;      } 

why don't do

public myexception(string message, double qtyavail){     super(message + " " + qtyavail); } 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -