Java Beans Example

public class JavaBeansDemo {
	private String empCode, empName;
	private int salary;
	public JavaBeansDemo() {
		super();
	}
	public JavaBeansDemo(String empCode, String empName, int salary) {
		super();
		this.empCode = empCode;
		this.empName = empName;
		this.salary = salary;
	}
	// getter/accessor method
	public String getEmpCode() {
		return empCode;
	}
	// setter/mutator method
	public void setEmpCode(String empCode) {
		this.empCode = empCode;
	}
	public String getEmpName() {
		return empName;
	}
	public void setEmpName(String empName) {
		this.empName = empName;
	}
	public int getSalary() {
		return salary;
	}
	public void setSalary(int salary) {
		this.salary = salary;
	}
}

Download

Java Basics Examples

Default constructor example
Parameterized constructor example
Call other constructor
Command Line argument example
Display sum of Command Line arguments
Foreeach example with int data type [ Only in JDK 1.5 ]
Foreeach example with String data type [ Only in JDK 1.5 ]
Foreeach example with user defiend [ Only in JDK 1.5 ]
Simple Inheritance
Call default constructor in Inheritance
Call parameterized constructor in Inheritance
Java Beans example
Overload method in one class
Overload method in inheritance
Override example , super keyword
super keyword example
override toString method


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code