// class-1 book
class
library
{
int bookno;
void
getbookno(int n)
{
bookno=n;
}
void
displaybookno()
{
System.out.println("THE
BOOK NUMBER IS "+bookno);
}
}
//class-2 single inheritence
class book
extends library
{
String
author,title;
void
getbookinfo(String s1,String s2)
{
author=s1;
title=s2;
}
void
displaybookinfo()
{
System.out.println("THE
BOOK AUTHOR IS "+author);
System.out.println("THE
BOOK TITLE IS "+title);
}
}
//interface
interface
language
{
public
String s="ENGLISH";
public void
displaylanguage();
}
//class-3 issue main function of
the library
class issue
extends book implements language
{
//interface
method overriding
public void
displaylanguage()
{
System.out.println("THE
BOOK WAS WRITTEN IN THE "+s);
}
//issue class
specific method
void
displayissue()
{
displaybookno();
displaybookinfo();
displaylanguage();
}
}
//class-4 implementer class
public class
libimpl
{
public
static void main(String agrs[])
{
issue i=new
issue();
i.getbookno(1000);
i.getbookinfo("RAMU","INTERNET
AND JAVA PROGRAMMING ");
i.displayissue();
}}
OUTPUT:-
The output for the above program is
The book number is 1000
The book author is RAMU
The book title is JAVA & INTERNET
PROGRAMMING
The book was written in ENGLISH
Note:-
Add to the
above program arrays concept to store more books information and go on for
further development according to u r requirement s
కామెంట్లు లేవు:
కామెంట్ను పోస్ట్ చేయండి