Hey all..am quite new to Java and I have encoutered a problem with my program. I am getting the error message "cannot find symbol constructor". I have tried to figure it out but I have failed. I have read around that adding an empty constructor would help but this is not working either so I am just confused. any help is needed.thanks. Below is the entire code.

class Book{
	
	private String author;
	private String title;
	private int year;
	private Chapter first;
	private Chapter second;
	private Chapter third;
	
	public Book(){
		/*author="josh";
		title="josh";
		year=0;
		first=0;
		second=0;
		third=0;*/
	}
	
	public void Book(String author, String title,int year,Chapter first,Chapter second,Chapter third){
	
		this.author=author;
		this.title=title;
		this.year=year;
		this.first=first;
		this.second=second;
		this.third=third;
		
	}
	
	public String getAuthor()
	{
		
		return author;
	}
	
	public String getTitle()
	{
		return title;
	}
	
	public int getYear()
	{
		return year;
	}
	
		
	/*private int TotalPages()
	{
		return numberOfPages;	
	}*/
	
	public void printInfo()
	{
		System.out.println("Book title: " +getTitle());
		System.out.println("");
		System.out.println("Book Author:" +getAuthor());
		System.out.println("");
	/*	System.out.println("Chapter1:");
		System.out.println("");
		System.out.println("Title:" +getTitle());
		System.out.println("");
		System.out.println("Number of pages:" +getPages());
		System.out.println("");
		System.out.println("Chapter2:");
		System.out.println("");
		System.out.println("Title:" +getTitle());
		System.out.println("");
		System.out.println("Number of pages:" +getPages());
		System.out.println("");		
		System.out.println("Chapter3:");
		System.out.println("");
		System.out.println("Title:" +getTitle());
		System.out.println("");
		System.out.println("Number of pages:" +getPages());
		System.out.println("");*/
	}

}

class Chapter
{
	
	private String title;
	private int numberOfPages;
	
	public Chapter()
	{
		title="";
		numberOfPages=0;	
	}
	
	public void Chapter(String title, int numberOfPages)
	{
		this.title=title;
		this.numberOfPages=numberOfPages;
	}
	
	public String getTitle()
	{
		return title;
	}	
	
	public int getPages()
	{
		return numberOfPages;
	}
	 
}

class mainPrg
{

	public static void main (String[] args)
	{
		Chapter chptobj1=new Chapter("Introduction",100);
		Chapter chptobj2=new Chapter("Main Ideas", 150);
		Chapter chptobj3=new Chapter("Conclusion", 200);
		
		Book bkobj1=new Book();
		
	//	chptobj1.printInfo("josh","A good year",2008,100,201,301);
	}
}

PS. Please ignore the comments

Please post the errors you get and at which line you get them

Iam getting the same error message below from line 115 to line 117
"cannot find symbol constructor Chapter(java.lang.String,int)"

Hey,

The problem is you are calling a non-existing contructor. You don't have a constructor which can receive any args, because a method returning void is NOT a contructor :-)

Thanks. that worked but I need some more clarification. In the class Book, the constructor is "public void Book(..)" How come this does not give any errors?

That is just a method declaration, not a constructor. As already stated above, constructors do not specify a return type because they always return an instance of that class.

Oh...I think I get it now. Thanks