View RSS Feed

Java Object

Object-oriented programming in Java.

  1. Using this with a Constructor

    by , 04-26-2012 at 04:41 PM
    Within constructor, this keyword could also be used to call the other constructor present in same class. This is known as explicit constructor invocation. Other Rectangle class present here along with varying implementations from that which is present in Objects section.
    Java Code:
    public class Rectangle {
        private int x, y;
        private int width, height;
        public Rectangle() {
            this(0, 0, 0, 0);
        public Rectangle(int