Constructors vs setter methods.


In main method which should I use?



```
CarOwner owner = new CarOwner("Danni", "123456789");

```

or



```
CarOwner owner = new CarOwner();
owner.setName("Danni");
owner.setPhoneNumber("123456789");

```

I know how to make both work, I can edit the class file to suit whichever way it is written in the main method. But what do people do in real life?


Can someone confirm if these are fact or myth?


* to set an inital value of a class property you use a constructor
* you use setter methods instead of using constructors
* you use the setter methods to 'modify' a property
* using a constructor or setter method to set a property depends on whether the property value is likely to change
Yes..what you said is true and depends on the person and requirement to decide which one he/she should use. Absolutely it doesn't make difference whether you use constructor or setter methods.  

If you have a constructor that accepts arguements, then you can happily initialize in the constructor itself. Otherwise you can use setter methods instead. Either way , both approaches results same.


You can say



```
 JFrame f=new JFrame("this is title");

    or

 JFRame f=new JFrame();
 f.setTitle("this is title");

```

Both are SAME.. BUT observe one important thing in the above code


In the first method , we are directly calling the constructor which accepts the title value.  

Where as in the second method , we are setting the title value using Setter method.


In the first case, if you want to change the title of the jframe sometime later in your code ,you CANT change it . You have to create a new object inorder to change the title which is not what you need.


Where as in the second code , you can change the title of the jframe at any given point of time by just calling the setter method.


So it all depends on your requirements.
method a.increment() overlaps in class b.   
 therefore, regardless of the type of the variable obj, will be called the method corresponding to the actual type of the object - that is, b.increment().  
 
this method will use the variable i, declared in the same class b and having an initial value of 10.  
 
the resulting value - 11. in general terms, i would say that it is a default value. it is always good to put it, but in most cases it it the default. [image] endermaz41:

didn't know what to put in the error portion

first of all, err(…) is a value, not a type. since err is a variant ("constructor" if you like) of enum result, if you invoke it, you get a value of type result. you won't get a value of the error type itself, much less a type.

… "insurance companies view older, new drivers just as high risk as younger, new drivers. the reason why older drivers have better rates is typically because they've been driving longer. 
 
older drivers are often able to prove to insurance companies that they're reliable. a new driver hasn't had that experience, so insurance companies are taking on more risk by insuring them.
 
additionally, since you live in a large city, your rates will normally be higher than a suburb or smaller town. 
 
to find out what your rate will be, you'll want to request [car insurance quotes](https://getjerry.com/car-insurance) from different carriers. this will give you a good idea of how much you'll be paying in car insurance. 
 
while your rates may be high to begin with, your rates should begin to decrease if you maintain insurance and a clean driving record." <http://code.djangoproject.com/wiki/CookBookNewformsAdminAndUser>


Involves implementing save methods on your ModelAdmin objects. when it comes to booking directly or using one of the many authorized disney vacation planners, it really depends on your personal preferences. hi

we can do that by defining a string variable in the very beginning of the process with assign activity or by defining that in variable panel in the studio at the bottom the window

but make sure that we are not assigning any value to that variable later across the workflow

if we assign later th… method for handling data structures where the first element is processed first and the newest element is processed last. impact : changing c# methods from private to public i've been meaning to write a blog post on this for a while, but haven't got round to it yet, so i'll give the condensed version here :slight\_smile:

to understand why the if let syntax is the way it is, we should first look at the let syntax. in most cases, you'll see it used for simple variable dec…