Best ways to reuse Java methods

Posted by carillonator on Stack Overflow See other posts from Stack Overflow or by carillonator
Published on 2010-05-29T23:18:53Z Indexed on 2010/05/29 23:22 UTC
Read the original article Hit count: 215

Filed under:
|
|

I'm learning Java and OOP, and have been doing the problems at Project Euler for practice (awesome site btw).

I find myself doing many of the same things over and over, like:

  • checking if an integer is prime/generating primes
  • generating the Fibonacci series
  • checking if a number is a palindrome

What is the best way to store and call these methods? Should I write a utility class and then import it? If so, do I import a .class file or the .java source? I'm working from a plain text editor and the Mac terminal.

Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about best-practices