Constructor overloading
Java
Easy
5 views
Problem Description
Task: create Point with (x,y) and also default constructor (0,0).
Output Format
Return value
Constraints
Keep fields final.
Official Solution
static class Point{final int x;final int y;Point(){this(0,0);}Point(int a,int b){x=a;y=b;}}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!