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
Masteriza [31]
2 years ago
8

What can a method do with a checked exception? Check the exception or ignore it. Return the exception to the sender or handle it

in a catch block. Throw the exception to the method that called this method, or handle the exception in a catch block. Handle the exception in the try block or handle the exception in the catch block.
Computers and Technology
2 answers:
Serggg [28]2 years ago
8 0

Answer:

Handle the exception in a catch block or throw the exception to the method that called this method.

Explanation:

The try and catch statements occur in pairs. The try statement allows the user to define a block of code to be tested for errors while it is being executed.

The catch statement allows the user to define a block of code to be executed, if an error occurs in the try block.

If an exception is checked by a method, the method either handles the exception in a catch block or throw the exception to the method calling it.

Aneli [31]2 years ago
6 0

Answer:

Throw the exception to the method that called this method, or handle the exception in a catch block.

Explanation:

First let us understand what an exception is. A program is a set of instructions and it is executed in a flow which is called flow of program which an exception can interrupt. This exception is basically an unexpected event. Exception can be checked (which is compile time exception) or unchecked (run time exception).  When the exception object is created to indicate the type of error occurred which interrupted the program flow this exception is thrown which indicates that an unexpected event or error has occurred in a program.  

So when a exception is thrown one of two ways are used to deal with it

  • Handle the exception in a catch block,
  • Throw the exception to the method that called this method. It usually has a throw clause which defines what exceptions a method can handle and what not.

Exceptions are handles using try catch block. In this block there are two keywords which are used i.e. try and the other one is catch.

try basically defines a block of code. This block of code is executed and is checked for exceptions.

Now if the exception occurs, catch statement is used to handle this exception. So the catch part is executed when an exception occurs. However if catch statement fails to process this exception then this is thrown to the caller method.

A very common example is of a checked exception FileNotFoundException.

This error occurs when a program wants to read a file. So we get a compiler time exception to handle for situations in which the file does not exist in the location.

So this checked exception is handles either by the catch block or by throwing this exception to the method that called this method.

In catch block we can determine how to handle if the file is not found. If catch block is unable to handle this exception then we will use throw clause. So whenever this exception occurs the methods can throw the IOException and FileNotFoundException is basically a subclass of this. For example in JAVA, java.io.IOException is used for handling such exceptions.

You might be interested in
I know I should add Family and food by default (and I will) But I wanna hear some more from other peoples perspective
lidiya [134]

Answer:

you could say something like your friends or your pets if you have any pets you could say something like you are grateful that we now have 3 vaccines for the Coronavirus or like you are grateful for your hobbies because it gives you something to do in your free time.

Explanation:

i hope this helps.

7 0
3 years ago
Read 2 more answers
The ____________ command / function is used in Python graphics and text-based programming code.
sleet_krkn [62]

A. write()

2.4. Graphics

Graphics make programming more fun for many people. To fully introduce

graphics would involve many ideas that would be a distraction now. This section

4 0
2 years ago
What is a malicious actor essentially looking for when attempting a network attack?
ahrayia [7]

Answer:

information of personnel

Explanation:

4 0
3 years ago
Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less
nataly862011 [7]

Complete Question:

Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with a newline. Ex: For the user input 123, 395, 25, the expected output is:

Enter a number (<100):

Enter a number (<100):

Enter a number (<100):

Your number < 100 is: 25

Answer:

import java.util.Scanner;

public class num8 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int n;

       do{

           System.out.println("Enter a number (<100):");

           n= in.nextInt();

       }while(n>100);

       System.out.println("Your number < 100 is: "+n);

   }

}

Explanation:

Using Java programming language

Import the scanner class to receive user input

create an int variable (n) to hold the entered value

create a do while loop that continuously prompts the user to enter a number less than 100

the condition is while(n>100) It should continue the loop (prompting the user) until a number less than 100 is entered.

4 0
2 years ago
Read 2 more answers
Outlook 2016 is not only an email client, but it can also be used to schedule meetings and
klio [65]

Answer:

Outlook 2016 is not only an email client, but it can also be used to schedule meetings and <u>Manage appointments</u>.

Explanation:

Microsoft Outlook is a tool that is used to send and receive emails. In outlook 2016 version it has many other advantages such as:

  1. Managing Contact Directory
  2. Managing Address Books
  3. Scheduling Meetings
  4. Managing Appointments
5 0
3 years ago
Read 2 more answers
Other questions:
  • In Microsoft Word, how would you change the amount of space that is put in after each paragraph?
    15·1 answer
  • How is typing speed measured
    12·2 answers
  • Sabian que hay una violadora sexuar el nombre de usario es SASHENKAFASION me acaba de decir que hackio en donde vivo,mi nombre c
    5·1 answer
  • You will be creating a quiz grading program. You will compare the student's answers with the correct answers, and determine if t
    15·1 answer
  • Write a C program (doublecopy) that allows a user to extract some part of an existing file (fileSource) and copy it twice to a n
    5·1 answer
  • Most significant effect the rotary press had on printing
    9·1 answer
  • How are digital and analog data similar? How are they different?
    15·1 answer
  • Why do we need to learn about engineering and technology?
    6·1 answer
  • A company is looking for an employee to help organize customer information for the sales team. Which computer field includes thi
    15·2 answers
  • 48
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!