![UML[ 01 ] Code with Abstract and Interface 1 UML[ 01 ] Code with Abstract and Interface 1](https://old.nurnobishanto.com/wp-content/uploads/2019/12/Q1.jpg)
public class Book {
public String bId,bName;
public Book(String bId,String bName)
{
this.bId=bId;
this.bName=bName;
}
public void display()
{
System.out.println("Book ID:"+bId+"\tBook Name:"+bName);
}
}
public interface Habits {
public void reading();
}
public abstract class Person {
public int age;
public Person(int age)
{
this.age=age;
}
public abstract void display();
}
public class Student extends Person implements Habits {
public String id;
private String name;
Book book;
public Student(int age,String id,String name,Book book) {
super(age);
this.id=id;
this.name=name;
this.book=book;
}
public void display()
{
System.out.println("Age:"+age);
System.out.println("ID:"+id+"\tName:"+name);
book.display();
}
public void reading() {
System.out.println(name+" Read the Book!");
}
public static void main(String[] args) {
Book b1 = new Book("CSE-212","OOP");
Student s1= new Student(21,"11820","Nurnobi Hosen",b1);
s1.display();
s1.reading();
}
}
- UML[ 03 ] Code with Abstract and Interface
- UML[ 02 ] Code with Abstract and Interface
- UML[ 01 ] Code with Abstract and Interface
- UML Diagram to JAVA code [problem 5]
- UML Diagram to JAVA code [problem 4]
- UML Diagram to JAVA code [problem 3]
- UML Diagram to JAVA code [problem 2]
- UML Diagram to JAVA code [problem 1]
- Has relationship (Association) | Java UML to source code
- [ Is a ] Relationship (Inheritance) | Java UML source Code
- Story to UML to Java Source Code – 1