daily pastebin goal
50%
SHARE
TWEET

blah

a guest Oct 21st, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Course{
  2.   public String coursename;
  3.   public Course(String c){
  4.     coursename = c;
  5.   }
  6. }
  7. public class Teacher {
  8.   public String name, dept, add;
  9.   public Teacher(String n, String d){
  10.     name = n;
  11.     dept = d;
  12.   }
  13.   public void addCourse(Course c){
  14.     if(add==null)
  15.     add = c.coursename;
  16.     else
  17.       add = add+ "\n"+c.coursename;
  18.   }
  19.   public void printDetail(){
  20.     System.out.println("========================");
  21.     System.out.println("Name: "+name);
  22.     System.out.println("Department: "+dept);
  23.     System.out.println("List of courses");
  24.     System.out.println("========================");
  25.     System.out.println(add);
  26.     System.out.println("========================");
  27.   }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top