Does java support constructor with default valued parameters e.g.
public Shape(int v=1,int e =2){vertices =v;edges = e; }
No it doesn't. Java doesn't support default arguments in any function; constructors included.
What you can do though is define public Shape(int v, int e) and also a default constructor
public Shape()
{
this(1, 2);
}
Note the special syntax here to delegate the construction to the two-argument constructor.
public Shape()will callthis(int, int)with default values. Also you can create a vararg constructor if number of arguments vary.