I agree with Mauro ALLEGRANZA's answer. I am providing this answer to complement it.
Since you are learning logic on your own I will illustrate a solution to this problem using forall x: Calgary Remix and Kevin Klement's natural deduction proof checker. These are available online and could supplement the text you are using. They cover truth-functional logic and first order logic.
You have a truth-table as one way to show the validity of the argument. Here is a derivation illustrated with a natural deduction Fitch-style proof checker:
On line 1, the premise "¬A" is stated. This was automatically provided once I entered the premise and the conclusion in the proof checker.
On line 2, I assume "A". I can assume anything. Ideally I want to assume something useful in achieving the goal which is "A→B". This assumption is indented because the proof checker uses the "Fitch-style".
On line 3, I note that line 1 and line 2 are contradictory, so I introduce (I) a contradiction (⊥) and reference lines 1 and 2 (⊥I 1, 2). The software will make sure I get this correct. If it is not when I click "Check Proof" it will show an error and not let me reach the "Congratulations!" confirmation message.
On line 4, I use something that should seem shocking. It is called "explosion" (X). If I have a contradiction, I can then place on this line anything. Since I need "B", I put "B" there and justify it using explosion and reference line 3 where I introduced the contradiction (X 3).
On line 5, I "discharge" the assumption I made on line 2 by restating that indented subproof as a conditional, if "A" then "B" or "A→B", and justify that line by using (→I 2–4) where I introduce (I) the conditional (→) referring to a string of lines starting at 2 and ending at 4. This new line can be thought of as a summary of those three lines.
Beyond the truth table and the natural deduction argument, you might still ask why should this work?
Think of "A" as the symbolization for this English sentence: "The moon is made of green cheese." Clearly, that is not the case. So "¬A" is true. Now assume that the moon is made of green cheese. To make this even more concrete, suppose I'm writing a novel with a green-cheese moon. Then what? Then anything can happen that I want to happen.
P. D. Magnus, Tim Button with additions by J. Robert Loftis remixed and revised by Aaron Thomas-Bolduc, Richard Zach, forallx Calgary Remix: An Introduction to Formal Logic, Winter 2018. http://forallx.openlogicproject.org/
Wikipedia, "Fitch notation" https://en.wikipedia.org/wiki/Fitch_notation