Encapsulation java program
Answers
Answered by
0
Answer:
//It has a private data member and getter and setter methods.
package com.javatpoint;
public class Student{
//private data member
private String name;
//getter method for name
public String getName(){
return name;
}
//setter method for name
public void setName(String name){
this.name=name
}
}
Similar questions
Social Sciences,
2 months ago
English,
4 months ago
English,
4 months ago
Science,
11 months ago
Hindi,
11 months ago