Menu
Question Index
...

Given a Java bean, write a program to create getters and setters method signatures. The fields should be sorted by name. If it is boolean datatype, you need to use 'is' instead of 'get'.

Input (Object) Output (String)
new Student() public boolean isGender()
public void setGender(boolean gender)
public int getId()
public void setId(int id)
public int getMarks()
public void setMarks(int marks)
public String getName()
public void setName(String name)
public double getPercentage()
public void setPercentage(double percentage)
public char getSection()
public void setSection(char section)
new Employee() public String getDesignation()
public void setDesignation(String designation)
public boolean isGender()
public void setGender(boolean gender)
public String getName()
public void setName(String name)
public double getSalary()
public void setSalary(double salary)
new Mobile() public String getCompanyName()
public void setCompanyName(String companyName)
public float getPixel()
public void setPixel(float pixel)
public double getPrice()
public void setPrice(double price)
public int getResolution()
public void setResolution(int resolution)
new College() public String getAddress()
public void setAddress(String address)
public String getCollegeCode()
public void setCollegeCode(String collegeCode)
public String getCollegeName()
public void setCollegeName(String collegeName)
public int getStudents()
public void setStudents(int students)


import java.lang.reflect.*;
import java.util.*;
class CreateGettersAndSettersMethodSignatures
{
    public static void main(String s[])
    {
        Student student = new Student();
        String result= createSettersAndGetters(student);
        System.out.println(result);

    }


    public static String createSettersAndGetters(Object object) {
    }
    

}
class Student {

String name;
boolean gender;
int marks;
double percentage;
char section;
int id;
}

class Employee {

double salary;
String name;
String designation;
boolean gender;
}

class Mobile {

String companyName;
double price;
float pixel;
int resolution;
}

class College {

int students;
String collegeCode;
String address;
String collegeName;
}

Doubts

Problems

Topic: Other Advanced Topics In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App