Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Question!


Name: athul
Title:
  java
Question:
import java.io.*;
interface Book
{
void read();
void print();
}
class A implements Book
{
int n,i;
/*DataInputStream in=new DataInputStream(System.in);*/
String booknam[]=new String[30];

     public void  read()
     {
     DataInputStream in=new DataInputStream(System.in);
     System.out.println("enter the no of books");
     n=Integer.parseInt(in.readLine());
     System.out.println("enter the name of the books");
     for(int i=0;i<n;i  )
     {
     booknam[i]=in.readLine();
     }
     }
     public void print()
     {
     System.out.println("the books are");
     for(i=0;i<n;i  )
     {
     System.out.println(booknam[i]);
     }
     }
}
class Booklist3
{
public static void main(String[] args) throws IOException
{
A subob=new A();
subob.read();
subob.print();
}
}
Answers: