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]
2 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]2 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
Menus are attached to the windows by calling
Lemur [1.5K]

i dont know da answer

4 0
2 years ago
Why is it important to save a print copy of electronic sources
AURORKA [14]
I don't exactly know WHY, but I can guess..
I think it's because, if you're writing, you can know where the source is from if you print the WHOLE SCREEN, or just to remember what the electronic source says.
4 0
2 years ago
If you could own a large technology Company, which one would it be and why
Lilit [14]
I would own Apple. Because I would be rich and create apple products
6 0
3 years ago
How would you "break" a firewall in a laptop computer if you were no longer a administrator? (Cyber Security Related, Computers
4vir4ik [10]
Okay so what you would is press ctrl+alt+delete and click log out i think but if you have a disk put it in and secure everything trust me i am a computer savage. i hack thing all the time.

6 0
2 years ago
E whether True or False.
Natasha_Volkova [10]

Answer:

Learn vocabulary, terms, and more with flashcards, games, and other study ... covers a large geographical area and is made up of many smaller networks. ... you share the cable infrastructure with your neighbors ... do you need if you want to connect two network segments together such as a ... the twists reduce crosstalk.Explanation:

5 0
2 years ago
Other questions:
  • Mm
    10·1 answer
  • What is the top folder of the file tree called
    5·2 answers
  • Importance of Computer in the world​
    12·2 answers
  • Which component of the windows desktop allows you to retrieve files that have recently been deleted?
    11·1 answer
  • You work for a company that builds custom PCs for select clients. You are training a new employee to evaluate and select appropr
    13·1 answer
  • Which search engine does not track users? Choose the answer.
    10·2 answers
  • How would you describe<br> "analogous color harmony" to a six year old?
    13·1 answer
  • You are between flights at the airport and you want to check your email. Your wireless settings show two options:
    14·1 answer
  • The microprogram counter (MPC) contains the address of the next microcode statement for the Mic1 emulator to execute. The MPC va
    12·1 answer
  • Screen reading for extended periods can cause___________ _____________, so the position the monitor to minimize glare and give y
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!