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
hjlf
3 years ago
11

. Write a statement that throws an IllgalArgumentException with the error message Argument cannot be negative.

Computers and Technology
1 answer:
dybincka [34]3 years ago
8 0

Answer:

public class PostAccount

{

  public void withdraw(float savings)

  {

     if (savings >=0 )

     {

        IllegalArgumentException exception

              = new IllegalArgumentException("Savings cannot be negative");

        throw exception;

     }

     balance = savings - withdraw;

  }

 }

Explanation:

IllgalArgumentException is a type of NumberFormatException  of runtime exception. Here in the program we have created an object of IllgalArgumentException class and after that we have thrown the error to show the condition if it does not satisfy the if condition.

You might be interested in
Which of the following software maintenance steps erases gaps caused by deleting files from the hard drive?
slega [8]

your answer is B) Defragging.

7 0
3 years ago
What are the main types of database end users,? Discuss the main activi-ties of each
soldi70 [24.7K]

Answer:

Categories of End Users in DBMS

Casual End Users – These are the users who occasionally access the database but they require different information each time. ...

Naive or parametric end users – These are the users who basically make up a sizeable portion of database end users. ...

Sophisticated end users – ...

Standalone users –

6 0
3 years ago
The HTTP protocol operates at which layer?
Ludmilka [50]

Answer:

transport

Explanation:

taking you to what ever website you want

5 0
3 years ago
Three common risk factors for young drivers and how you plan to minimize these factors.
djverab [1.8K]

Answer: making a simple mistake which ends in someone getting hit or close to being hit like not turning on your signal light

going too fast which makes it more difficult to make turns properly

if the car is a manual trying to start on a hill and rolling backwards into a car

Drivers ed and practicing in a parking lot or something or the sort

Explanation:

7 0
4 years ago
A trojan horse
svp [43]
A trojan horse is software that appears to be benign but does something other than expected.
6 0
4 years ago
Other questions:
  • Which of the following is not an example of technological progress? A: new scientific knowledge that has practical applications
    12·2 answers
  • Technology offers a variety of rich opportunities available to teachers and students. According to Inan and Lowther (2010), ther
    6·1 answer
  • How to upgrade from office home to office professional
    13·1 answer
  • A technician is talking to end users about the specifications for an upgraded application server. The users of the application r
    11·1 answer
  • Using underlining and italics at the same time is which of these? A. allowed but might be overkill B. always a good idea C. not
    15·2 answers
  • The Mail Merge option is located in which tab? a;home b;insert c;refernces d;mailings
    11·2 answers
  • Help me pls, thank you
    12·2 answers
  • What is the correct way to write h1 tag
    12·1 answer
  • Functions are used to _________
    10·1 answer
  • Ethics related to all <br> artificial intelligence?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!