Problem: My overloading constructors are undefined, even though I'm doing the right thing (I think so?).
The source code:
class Book {
String section;
float subject2;
char section2, author;
int subject, author2, year;
Book(String section, int subject, char author, int author2, int year) {
this.section = section;
this.subject = subject;
this.author = author;
this.author2 = author2;
this.year = year;
}
Book(char section2, float subject2, char author, int author2, int year) {
this.section2 = section2;
this.subject2 = subject2;
this.author = author;
this.author2 = author2;
this.year = year;
}
void displayData() {
System.out.println(section + subject + " ." + author + author2 + " " + year);
}
void displayData2() {
System.out.println(section2 + subject2 + " ." + author + author2 + " " + year);
}}
public class TestBook {
public static void main(String[] args) {
Book book1 = new Book("LB", 2395, "C", 65, 1991);
Book book2 = new Book("E", 185.86, "P", 277, 2010);
book1.displayData();
book2.displayData2();
s.close();
}}
Apologies for the length if it bothers. Thanks for helping in advanced!
"C"is aString,'C'is achar.