Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

bookuser class calls the book class and uses it to print out a book title

  Asked By: Kent    Date: Feb 26    Category: Java    Views: 1212
  

please can some one help me. i can'nt get the problem below to work.
The bookuser class calls the book class and uses it to print out a
book title.



import java.util.*;
public class Book{




public String title, isbn, publisher;
public Date pubDate;


public Book(String t, String i, String p, Date d)
{
title = t;
isbn = i;
publisher = p;
pubDate = d;
}

}


import java.util.*;
public class Bookuser{

public static void main( String[]args)

{

Date Today;

Book b1 = new Book("great
expectasions","01234","orchard",Today);
System.out.println( b1.title);



}


}

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Chaths Massri     Answered On: Feb 26

Your date  variable Today may not have been
initialized! Initialize it using one of the following
statements:

Date Today = null
// or
Date Today = new Date();

 




Tagged: