public class BeanClass
{
public BeanClass (){}
public void setName (String name){
this.name =name;
}
public String getName ()
{
return this.name;
}
}
I want to retrieve above methods in main metod of other new project using net beans. I have defied above class in library class and was added under bean tree of pallet
In another class:
import your.package.BeanClass;
BeanClass beanclass = new BeanClass();
beanClass.setName("bob");
String beanName = beanClass.getName();
You have to set the project as a library, and add it as a reference to your new project, alternatively, you could export a reference jar
, and add that as in import to your new project.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.