Menu
Question Index
...

Write a program to copy the details of the input book into another book.



class CopyBookDetails
{
    public static void main(String s[])
    {
        Book java = new Book();
        java.name = "Java The Complete Reference";
        java.author = "Herbert Schildt";
        java.edition = 7;
        java.numberOfPages = 1116;
        java.price = 531.0;
        
        Book copy = new Book();
        copyBookDetails(java, copy);
        
        System.out.println("Book Name = " + copy.name);
        System.out.println("Author = " + copy.author);
        System.out.println("Edition = " + copy.edition);
        System.out.println("Pages = " + copy.numberOfPages);
        System.out.println("Price = Rs. " + copy.price);

    }


    public static void copyBookDetails(Book input, Book output)
    {
    }

}
class Book
{
    String name;
    String author;
    int edition;
    int numberOfPages;
    double price;
}

Doubts

Problems

Topic: Class References And Objects In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App