Ad
  • Default User Avatar

    Since it's an int variable, the number will round up and wont be .5 as that's for floats and doubles.

  • Default User Avatar

    It's used to refer to objects that are specific to that method. Since different classes can override methods, the use of "this" basically eleminated confusion between classes that have the same parameter.
    So for example, two methods may both have int x but using "this.x", you can specify that it's this x for this specific method.

    If you have a good understanding of method overriding then this would be more understandable. I hope I cleared up some confusion ;)