
How to set values in object using java ?what are the ways

Hi You can set the value the object Using Setter Getter Methods. Please create the Setter Getter method for all the field in which you have to set the value. Example -
public class Test{ private int num;
// This method sets the value to the variable of the object public void setNum(int num){ this.num=nym; }
// This method will Return the value of the objetc. public int getNum(){ return this.num; } }
IDE Eclipse provides a very simple way to do this. In Eclipse do the following
Open the class in which you have to generate setter gettre methods
Go tho the "Source" Menu And click on the Generate Setter Getter method

Hi You can set the value the object Using Setter Getter Methods. Please create the Setter Getter method for all the field in which you have to set the value. Example -
public class Test{
private int num;
// This method sets the value to the variable of the object public void
setNum(int num){
this.num=nym;
}
// This method will Return the value of the objetc. public int getNum(){
return this.num;
}
}
IDE Eclipse provides a very simple way to do this. In Eclipse do the following
Open the class in which you have to generate setter gettre methods
Go tho the "Source" Menu And click on the Generate Setter Getter method
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.