1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ainat [17]
3 years ago
9

Write a class named Book containing: Two instance variables named title and author of type String. A constructor that accepts tw

o String parameters. The value of the first is used to initialize the value of title and the value of the second is used to initialize author. A method named toString that accepts no parameters. toString returns a String consisting of the value of title, followed by a newline character, followed by the value of author.
Computers and Technology
1 answer:
andrey2020 [161]3 years ago
3 0

Answer:

The code to this question can be given as:

Code:

public class Book  //define class.  

{

private String title, author;   //define variable.

Book(String a, String b)  //define parameterized constructor.

{

title = a;   //holding value.

author = b;

}

public String toString()  //string function

{

return title + "\n" + author;    //return value.

}

}

Explanation:

In the above java code firstly we declare the class book that name is already given in the question. Then we declare the private variable that datatype is string author and title. Then we declare the parameterized constructor. In the parameterized constructor we use the private variable for hold constructor parameter value. Then we declare the tostring() function in this function we return value of the title and author variable.

You might be interested in
What is better in everybodys opinion. AMD or Intel?
Rama09 [41]

Answer:

Intel is more for work and such, while AMD is foucsed on gamers. I use AMD because I play many games, but it really depends on what you use your computer for.

Explanation:

4 0
3 years ago
Read 2 more answers
why is it important for young people to start saving early as possible given the principles of interest?
hjlf
<span>Saving at a young age could be a really great investment on your future from years from now. It has several benefits like learning how to handle your money properly, investing to grow your money more and an early retirement with a lot of coins in your pocket for when you want to enjoy traveling more.</span>
5 0
3 years ago
Read 2 more answers
What should you do in order to have access to the header and footer tools? Open the View tab. Open the Page Setup dialog box. Op
Svetach [21]

Answer:

Step 1  - Open the View tab.

Step 2 - Open the Page Setup dialog box

Step 3 - Open the header and footer tool.

Step 4 - Click OK.

Explanation:

In order to access to the header and footer tools

Step 1  - Open the View tab.

Step 2 - Open the Page Setup dialog box

Step 3 - Open the header and footer tool.

Step 4 - Click OK.

4 0
2 years ago
Insurance can help you:
Blababa [14]
No it can not .............
3 0
3 years ago
When you must give something up in order to get something else it's called
matrenka [14]

Answer:

Opportunity cost refers to what you have to give up to buy what you want in terms of other goods or services. When economists use the word “cost,” we usually mean opportunity cost.

Explanation:

please give me a heart

8 0
3 years ago
Other questions:
  • When you hack a website, do you enter in the master code in the html section code data, or the offline/online system?
    14·1 answer
  • Write a complete C++ program that do following. Read a positive integer from the user with proper prompt. Assume that this user
    9·1 answer
  • I need someone who knows HTML to finish the code.
    12·2 answers
  • (I'm sorry that this question isn't school related, I can't find answers anywhere else)
    8·1 answer
  • When changing the formatting of a spreadsheet to make it more readable, you should use light blue text on a bright blue backgrou
    12·1 answer
  • What are youth oraganizations?
    7·1 answer
  • in java Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, o
    13·1 answer
  • Select the correct answer.
    9·1 answer
  • Does anyone know what i did wrong?
    13·1 answer
  • 13. In cell B16, use the SUMIF function and structured references to display the total wins for teams in the Youth league.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!