Question:

Can anyone tell about what is javabeans?

by  |  earlier

0 LIKES UnLike

Can anyone tell about what is javabeans?

 Tags:

   Report

3 ANSWERS


  1. I THINK its what u make java coffee out of but im not that sure. its also a type of media/flash player thing on computers.


  2. JavaBeans are reusable software components for Java that can be manipulated visually in a builder tool. Practically, they are classes written in the Java programming language conforming to a particular convention. They are used to encapsulate many objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects.

    JavaBean conventions

    In order to function as a JavaBean class, an object class must obey certain conventions about method naming, construction, and behavior. These conventions make it possible to have tools that can use, reuse, replace, and connect JavaBeans.

    The required conventions are:

    The class must have a no-argument public constructor. This allows easy instantiation within editing and activation frameworks.

    The class properties must be accessible using get, set, and other methods (so-called accessor methods), following a standard naming convention. This allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties.

    The class should be serializable. This allows applications and frameworks to reliably save, store, and restore the bean's state in fashion that is independent of the VM and platform.

    Because these requirements are largely expressed as conventions rather than by implementing interfaces, some developers view JavaBeans as Plain Old Java Objects that follow specific naming conventions.

    JavaBean Example

    // PersonBean.java



    public class PersonBean implements java.io.Serializable {



        private String   name;

        private boolean  deceased;



        // No-arg constructor (takes no arguments).

        public PersonBean() {

        }



        // Property "name" (note capitalization) readable/writable

        public String getName() {

            return this.name;

        }



        public void setName(String name) {

            this.name = name;

        }



        // Property "deceased"

        // Different syntax for a boolean field (is vs. get)

        public boolean isDeceased() {

            return this.deceased;

        }



        public void setDeceased(boolean deceased) {

            this.deceased = deceased;

        }

    }

    // TestPersonBean.java



    public class TestPersonBean {

        public static void main(String[] args) {

            PersonBean person = new PersonBean();

            person.setName("Bob");

            person.setDeceased(false);



            // Output: "Bob [alive]"

            System.out.print(person.getName());

            System.out.println(person.isDeceased() ? " [deceased]" : " [alive]");

        }

    }

  3. it have many features like .net

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.