KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Are there any differences between the following two ways of field initialization? When to use which one? First way public class Class1 { private SomeClass someclass; public Class1() { someclass = new SomeClass(some arg); } } Second way public class Class1 { private SomeClass someclass = new SomeClass(some arg); } The field in the second example could be readonly.
Tags (comma-separated)
Save Edits
Cancel