Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.12 seconds.

  1. Replies
    20
    Views
    3,284

    Re: Create a polygone

    And to reiterate what helloworld922 said, you could also do something like this:


    ArrayList<Number> numbers = new ArrayList<Number>();
    Integer i = new Integer(1);
    Double d = new Double(3.14);...
  2. Replies
    20
    Views
    3,284

    Re: Create a polygone

    Sort of. If you don't use a getter or some other function (like in my example), then println() is going to look at the toString() method to figure out what it should print.


    Not necessarily. For...
  3. Replies
    20
    Views
    3,284

    Re: Create a polygone

    I suppose that's one way to do it. Or you could just use the getter functions in Point to print the values out yourself.

    For example, say I have a Rectangle r, and I want to print its width. I...
  4. Replies
    20
    Views
    3,284

    Re: Create a polygone

    The API is your friend.

    Java Platform SE 6 (that's a link, click it)
  5. Replies
    20
    Views
    3,284

    Re: Create a polygone

    Because that's what's returned by Point.toString(), which is probably just using Object's toString().

    What did you expect to print out? Java doesn't automatically know how to format a String...
  6. Replies
    20
    Views
    3,284

    Re: Create a polygone

    No. Your points ArrayList only accepts Doubles. A Point is not a Double, it contains Doubles (or doubles). Trying to add a Point to an ArrayList of Doubles won't work. Perhaps you want an ArrayList...
  7. Replies
    20
    Views
    3,284

    Re: Create a polygone

    2.7 is a double. 2.7f is a float. (float)2.7 is also a float.
Results 1 to 7 of 7