- package com;
- public class DoctorFinderDemo {
- public static void main(String[] args) {
- Doctor A=new Doctor(2,"Sai","Cardiologist",100);
- System.out.println(A.getDoctorName());
- System.out.println(A.displayDoctorDetail());
- }
- }
- package com;
- public class Doctor {
- int regNo;
- String doctorName;
- String specialization;
- int consultingFee;
- public Doctor(int regNo, String doctorName, String specialization, int consultingFee) {
- super();
- this.regNo = regNo;
- this.doctorName = doctorName;
- this.specialization = specialization;
- this.consultingFee = consultingFee;
- }
- public int getRegNo() {
- return regNo;
- }
- public void setRegNo(int regNo) {
- this.regNo = regNo;
- }
- public String getDoctorName() {
- return doctorName;
- }
- public void setDoctorName(String doctorName) {
- this.doctorName = doctorName;
- }
- public String getSpecialization() {
- return specialization;
- }
- public void setSpecialization(String specialization) {
- this.specialization = specialization;
- }
- public int getConsultingFee() {
- return consultingFee;
- }
- public void setConsultingFee(int consultingFee) {
- this.consultingFee = consultingFee;
- }
- public String displayDoctorDetail()
- {
- String name= "Doctor Name :"+getDoctorName()+" Specialization :"+ getSpecialization();
- return name;
- }
- }
[text] ijk
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new:
File Description
- ijk
- Paste Code
- 16 Sep-2019
- 1.32 Kb
You can Share it: