Calling Another Constructor with this keyword - Java Object Oriented Design

Java examples for Object Oriented Design:Constructor

Description

Calling Another Constructor with this keyword

Demo Code

class Circle { //  w  w  w . jav a 2 s. c o  m
        int x, y, radius; 

        Circle (int xPoint, int yPoint, int radiusLength) { 
            this.x = xPoint; 
            this.y = yPoint; 
            this.radius = radiusLength; 
        } 

        Circle (int xPoint, int yPoint) { 
            this(xPoint, yPoint, 1); 
        } 
    }

Related Tutorials