Setters and Getters [message #896358] |
Wed, 18 July 2012 07:53 |
Edmund Wong Messages: 2 Registered: July 2012 |
Junior Member |
|
|
Hi,
I'm new to Eclipse and am still fiddling with it.
Say I have the following class:
public class TestDog {
private int size;
private String name;
}
Is there a 'feature' in Eclipse that, when I right click(or select) on size,
it automatically creates both the setter and getter for that field? So
it automatically generates the following:
public class TestDog {
private int size;
private String name;
public void setSize( int pSize) { size = pSize; }
public int getSize() { return size; }
public void setName( String pName) { name = pName; }
public String getName() { return name; }
}
with a class that has a few fields, it's ok.. but if there are a lot,
it could be tedious to do that.
Edmund
[Updated on: Wed, 18 July 2012 07:54] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.07587 seconds