Answer to Question #295399 in Java | JSP | JSF for Akshay

Question #295399

Create a class Author whose attributes are: name, email, gender and books. Author constructor initializes the values


of name, email, gender and books. Define a static variable, method and block, and use this keyword in your code.

1
Expert's answer
2022-02-08T15:45:22-0500
import java.util.ArrayList;

public class Author {
    private String name;
    private String email;
    private String gender;
    private ArrayList<String> books;
    private static int authors;

    static {
        authors = 0;
    }

    public Author(String name, String email, String gender, ArrayList<String> books) {
        this.name = name;
        this.email = email;
        this.gender = gender;
        this.books = books;
    }

    public static int getAuthors() {
        return authors;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS