java - how do you know what parameters go inside the parentheses when creating a new object? -


i in process of learning java programming. see code looks this:

shape ball= new shape();.// takes no parameter shape ball= new shape(1,2); //takes parameter 

my question is, when object has multiple constructors take different paramaters, how know constructor use?

look @ documentation class. that's surefire way know. shape class provided has 2 constructors:

shape() //default no-args {     //do }  shape(int a, int b) {     //do , b } 

Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -