My Java is a bit rusty (been doing C# for the last couple of years). Also I hope this won't be a very subjective question.
Anyway say I had class Person
(yeah a bit of a cliche, I know), with no behaviour (C# version):
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
// say 10+ properties
}
How would the equivalent Java version look like ? I know I can write bunch of getters and setters (but say I had 10+ properties), it feels like a lot of boilerplate. Is it considered bad practice to just do:
public class Person {
public String name;
public int age;
// rest of the stuff here
}
I feel a bit uneasy about this. I realise there is no "right answer" but, I'm more interested in the general conventions and best practices.