(JAVAEE)Pengenalan Java Bean

Java Beans adalah kelas POJO yang serializable (implements java.io.Serializable), kelas Java Beans memiliki default contructor (constructor tanpa parameter), atribut yang ada di Java Beans harus private dan diakses oleh metode getter dan setter. http://khannedy.com/category/java/

 /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dede;

import java.util.Date;

/**
 *
 * @author Jarod United
 */
public class HelloBean implements java.io.Serializable {
         private String Param1;
    private Date param2 = new Date();
    
    public String getParam1(){
        return Param1;
    }
    public void setParam1(String param1){
        this.Param1 = param1;
    }
    
    public Date getParam2(){
        return param2;
    }
    
    public void setParam2(Date param2){
        this.param2 = param2;
    }
    
    public String toString(){
        return "SampleBean [param1=" + Param1 + ", param2=" + param2 + "]";

    }
}

Advertisements

Published by

jarcode

hello I am jarcode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s