String message = ""; for(Book book : arrayOfBooks) { if(inventoryNumberSearched == book.getInventoryNumber() { message = message + book.toString() } }
for (Book b : bookArray) { JOptionPane.showMessageDialog(null, b.toString()); }
for (int i = 0; i < listOfBooks.size(); i++) { Book b = listOfBooks.get(i); System.out.println(b.toString()); }
public void log(Book book) { LOG.info(book.toString()); }
public void searchByYear(int year){ boolean foundAny = false; for(Book s : books){ if(s.getYear()==year){ foundAny = true; System.out.println(s.toString()); } } if (!foundAny) { System.out.println("No match"); } }
// create the object Book myBook = new Book(); // now we will change the values for the members myBook.title = "Databases R Us"; myBook.numInStock = 50; myBook.cost = 50; myBook.stockNum = 5555; // Above were the settings for the Book object System.out.print(myBook.toString());
for (int i = 0; i < bookArray.length; i++) { Book b = bookArray[i]; b.calculateTotal(quantityArray[i]); //Using JOptionPane.showMessageDialog here only for an example, this probably isn't the OPs intent JOptionPane.showMessageDialog(null, b.toString();); }
Book book = new Book("123214213", "http://www.sth.com"); JSONObject jsobject = new JSONObject(book.toString()); JSONArray jsonArray = new JSONArray(); jsonArray.put(jsobject); //.....
Book tmp = (Book) JOptionPane.showInputDialog(null, "Books", "Books", JOptionPane.QUESTION_MESSAGE, null, ani, null); String userChoice = tmp.getName(); String userChoice2 = tmp.toString();
List<Book> listBook = new ArrayList<>(); listBook.add( whateveryouwant ); listBook.add( anothermedium ); System.out.println( "Enter the name of a book to see its details " ); System.out.println( "or input Catalog to see the catalog." ); Scanner scan = new Scanner( System.in ); String input = scan.nextLine(); for( Book book : listBook ) { if( "catalog".equalsIgnoreCase( input ) ) { System.out.println( "Title: " + book.getTitle() ); } else if( book.getTitle().equalsIgnoreCase( input ) ) { System.out.println( book.toString() ); } }
Log.d("getBook("+id+")", book.toString());
dbAdapter.close(); for (Book book : books) { Toast.makeText(getApplicationContext(), book.toString(), Toast.LENGTH_LONG).show();