Skip to main content

Re Java Beans

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2010-03-03

As-salamwalaikum 2 all javas. I am new to this site. I want to know how to create java beans progrm without net beans and eclipse.
Software java jdk1.6.0, bdk1.1.

Please help guys.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-05-05

create java beans progrm without net beans and eclipse:

For suppose if you have the following props,
id,name, price;

(1)The basic rule is need to have setters and getters for all the properties.
(2) The method names should follow the Java conventions. If you follow the conventions then we will get some extra functionalities provided by some frameworks.

Please check the sample code.

public class Product {
private int id;
private String name;
private float price;
public int getId() {
return id;
public void setId(int id) { = id;
public String getName() {
return name;
public void setName(String name) { = name;
public float getPrice() {
return price;
public void setPrice(float price) {
this.price = price;

public String execute(){
return "success";