Elgskred

toString()

Jan 27th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. public String toString()
  2. {
  3. String resultat;
  4. if(numerator == 0)
  5. {
  6. resultat = "0";
  7. }
  8. else if (denominator == 1)
  9. {
  10. resultat = ""+numerator;
  11. }
  12. else
  13. {
  14. resultat = numerator + "/" + denominator;
  15. }
  16.  
  17. return resultat;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment