If user enter all these then i need to use what to store it in a same group (many different group)

import java.util.Scanner;
class addBook
{
	public static void book()
	{

		int isbn;
		Scanner inputDevice = new Scanner (System.in);
		System.out.println("Enter ISBN ...\n");
		isbn = inputDevice.nextInt();

		int title;
		System.out.println("Enter TITLE ...\n");
		title = inputDevice.nextInt();

		int author;
		System.out.println("Enter AUTHOR NAME ...\n");
		author = inputDevice.nextInt();

		int pub;
		System.out.println("Enter Publisher ...\n");
		pub = inputDevice.nextInt();

		int pubDate;
		System.out.println("Enter DATE OF PUBLICATION ...\n");
		author = inputDevice.nextInt();



		}
}

create an Object which hold all this information in it's instance variables, and create either an array or list of objects of that type.

ps: this is not 'urgent' to most of us (well, none of us, except you maybe) and it's also very basic, you should be able to do this on your own.

1. You will need to create a class Book where you will have various set() and get() methods like:
setISBN()
getISBN()
don't forget constructor(s)

2.A class Libray which extends Book methods here:
super(...);
readData();
Furthermore make a search for:
a)Generics
b)ArrayList

If you have any questions post here or send me a Private Message.

1. You will need to create a class Book where you will have various set() and get() methods like:
setISBN()
getISBN()
don't forget constructor(s)

2.A class Libray which extends Book methods here:
super(...);
readData();
Furthermore make a search for:
a)Generics
b)ArrayList

If you have any questions post here or send me a Private Message.

unless you want to see your teacher burst out in a laughing fit when you hand in your code, don't do that.
as far as I am aware, a library HAS books it is not a SUBTYPE of book.

^ yes.
And why setISBN? A book's ISBN never changes. Declare it final and require it as a parameter in the constructor(s).
Finally DaniWeb Member Rules include:
"Do not ask anyone (member or moderator) for help by email or PM"
http://www.daniweb.com/forums/faq.php?faq=daniweb_policies
post your questions in the forum so others can help answer it and more people can learn from it.

Hi James. If we have to create objects of type Book for a bookstore or a library, we don't need to create set methods to store different values(String, int, etc.) when is needed? Otherwise we will not be able to create object. I am quite new with java and still learning.

For values that can change, yes. But if you have something like ISBN every book must have one, and it never changes, so the best way is to require it as a parameter in the constructor (so you can't create a book without an ISBN), and don't have a setISBN method so nobody can change it. The same is true of title and author. But if you have, for example, which shelf the book is on then you need set and get methods for that because the book can be moved to a different shelf, similar for price, becuase the price can change.

Hi James. If we have to create objects of type Book for a bookstore or a library, we don't need to create set methods to store different values(String, int, etc.) when is needed? Otherwise we will not be able to create object. I am quite new with java and still learning.

as JamesCherrill pointed out: an ISBN number, just like a title or author, of a book will NEVER change once it has been set. about the only thing that can change is the price, so that is the only variable you actually need a setter for.

all the other information can be set using the constructor.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.