answersLogoWhite

0

public class Student {

private int id;

private String name;

private String place;

private int contact;

public Student(){

}

public Student(String studentName, int studentId){

name = studentName;

id = studentId;

}

public int getId(){

return id;

}

public String getName(){

return name;

}

public String getPlace(){

return place;

}

public int getContact(){

return contact;

}

public void setId(int studentId){

id = studentId;

}

public void setName(String studentName){

name = studentName;

}

public void setPlace(String studentPlace){

place = studentPlace;

}

public void setContact(int studentContact){

contact = studentContact;

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

What are getters and setters method?

Getter method: A getter method have its name start with 'get', and take 0 parameters, and also returns a value. Setter method: A setter method have its name start with "set", and takes 1 parameter. Setters may or may not return a value. Some setters return void, some the value set.


What method in java performs some action (i.e. not assignments) other than returning a value?

Methods that are neither mutators (setters) or accessors (getters). This primarily includes the class constructors (the initialisers) and the class destructor (the restorer).


What is the major difference in class and interface in c?

The implementation detail. Classes may provide a default implementation, interfaces provide only the method signatures


What are read only objects in c plus plus?

Read-only objects are those that have private immutable member variables with public accessors (getters) but no public mutators (setters). The object members are typically initialised during construction, but the member variables cannot be altered thereafter, thus they are read-only.


Is it true or false - one problem with OOPS is that once a class is created it can never be changed?

If would have to say false. You would usually add a number of getters/setters to dynamically modify the contents of an object. You can also often respecify one object as another to allow access, for example, to its parent modifiers. You can also build a new class which inherits an existing class and builds upon it.

Related Questions

What are Java beans?

In eclipse you can create java bean by generating getters and setters. Getters and setters are generated as ' alt + shift + s + r'.


What are setters and getters?

As the name suggest Setters are to set value of an attribute and Getters are to get value of an attribute. sometime they are also called java beans.


What is getters in java?

GETters and SETters are functions that GET and SET the value of a private variable.example:.........private int power;// -----------------------......................................................... // |.......................................................... // |........................................................... // |........................................................... // | The User Gets The value of power.......................................................... // |public int getPower(){ //...................... |return power;//


What are getters and setters method?

Getter method: A getter method have its name start with 'get', and take 0 parameters, and also returns a value. Setter method: A setter method have its name start with "set", and takes 1 parameter. Setters may or may not return a value. Some setters return void, some the value set.


What method in java performs some action (i.e. not assignments) other than returning a value?

Methods that are neither mutators (setters) or accessors (getters). This primarily includes the class constructors (the initialisers) and the class destructor (the restorer).


How do you create a bean in Java?

In eclipse java beans can be created by using getters and setters. Example: public class Login { public String lmail; public String getLmail() { return lmail; } public void setLmail(String lmail) { this.lmail = lmail; }


What is the major difference in class and interface in c?

The implementation detail. Classes may provide a default implementation, interfaces provide only the method signatures


Who is Cammeron Setters?

Cammeron Setters is an American social media personality and content creator best known for her presence on platforms like TikTok and Instagram. She gained popularity for her engaging videos, often showcasing her lifestyle, fashion, and comedic skits. Setters has built a significant following through her relatable content and charismatic personality.


Who were the setters of Jametwon of Virginia?

They were English; English setters.


What are read only objects in c plus plus?

Read-only objects are those that have private immutable member variables with public accessors (getters) but no public mutators (setters). The object members are typically initialised during construction, but the member variables cannot be altered thereafter, thus they are read-only.


How heavy are English Setters?

English Setters weigh from 29 - 36 kg.


When was Maurice Setters born?

Maurice Setters was born on 1936-12-16.