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
taurus [48]
4 years ago
10

What is displayed on the console when running the following program? class Test { public static void main(String[] args) { try {

method(); System.out.println("After the method call"); } catch (RuntimeException ex) { System.out.println("RuntimeException"); } catch (Exception ex) { System.out.println("Exception"); } } static void method() throws Exception { try { String s = "5.6"; Integer.parseInt(s); // Cause a NumberFormatException int i = 0; int y = 2 / i; System.out.println("Welcome to Java"); } catch (RuntimeException ex) { System.out.println("RuntimeException"); } catch (Exception ex) { System.out.println("Exception"); } } } Question 8 options:

Computers and Technology
1 answer:
Nutka1998 [239]4 years ago
8 0

Answer:

RuntimeException

After the method call

Explanation:

Image showing the program output when executed is attached.

In the code snippet given, inside the main method which is the beginning of program execution, there is a try-catch blocks.

The try block is executed first and the catch block is only executed if an exception is thrown.

The try block has two statement to execute:

try {

        method();

        System.out.println("After the method call");

}

The first statement is executed by calling the method called method(). The second statement display the output: "After the method call".

When method() is called, a runtime exception is thrown and a catch block is executed which display the message: "RuntimeException".

runtime exception occur during the program execution. From the above code snippet, the runtime exception is thrown/caused by the line below:

Integer.parseInt(s);

It is cause because the when the string is converted to integer, it is not assigned to any variable and this lead to the runtime exception.

You might be interested in
A data ________ rule would prevent a user from entering text in a date/time field.
Mrrafil [7]
The answer is a Database
5 0
3 years ago
Read 2 more answers
Harlequin frogs are an endangered species that live in a small area of Costa Rica. The reasons for the species' decline is unkno
Damm [24]

Answer:

<u>a. The scientists must be careful of how many variables they include in their simulation so they do not cause further harm to the frogs.</u>

Explanation:

It is not statistically accurate to assume that the number of variables included in the simulation would cause further harm to the frogs because we need to <em>remember </em>that a simulation is simply a computerized imitation of a real situation, which is usually not totally alike with a real process.

So in no way from a statistical standpoint, does the scientists' decision on the number of variables causes direct harm to the frogs.

3 0
3 years ago
The below program uses an array salaryBase to hold the cutoffs for each salary level and a parallel array taxBase that has the c
marissa [1.9K]

Answer:

Check the explanation

Explanation:

1. After running the program for annual salary 40000 and 50000 and then enter 0

a) For annual salaries of 40000

taxRate will be . 20

taxToPay will be 40000 x .20 = 8000

b)For annual salaries of 50000

taxRate will be . 30

taxToPay will be 50000 x .30 = 15000

2. Modify the program to use two parallel arrays named annualSalaries and taxesToPay

a) For implementing array of anuualSalaries that take input from user, refer following given code:

Scanner s=new Scanner(System.in);

   System.out.println("enter number of anuualSalaries");

   int n=s.nextInt();

   int anuualSalaries[]=new int[n];

   System.out.println("enter anuualSalaries");

   for(int i=0;i<n;i++){//for reading array

       anuualSalaries[i]=s.nextInt();

b) For implementing array of taxestoPay refer following code

int taxestoPay[] = new int[anuualSalaries.length];

       for (int i = 0; i < taxestoPay.length; i++) {

           taxestoPay[i] = "enter the result value of tax to pay"

       }

4. For two dimensional array of salariesAndTaxes refer following given code

int[][] salariesAndTaxes = new int[2][];

salariesAndTaxes[0] = new int[10];

salariesAndTaxes[1] = new int[10];

5 0
3 years ago
1
Vitek1552 [10]

Answer:

A

Explanation:

.

.stack 4096

ExitProcess PROTO, dwExitCode:DWORD

.data

Sun=0

Mon=1

Tue=2

Wed=3

Thu=4

Fri=5

Sat=6

warray BYTE Sun, Mon, Tue, Wed, Thu, Fri, Sat

INVOKE ExitProcess, 0

7 0
3 years ago
Application program?​
Butoxors [25]

Answer:

Explanation:

An application, also referred to as an application program or application software, is a computer software package that performs a specific function directly for an end user or, in some cases, for another application. An application can be self-contained or a group of programs.

6 0
4 years ago
Other questions:
  • Write a Scheme function called "sum" which takes an input function func and a nonnegative number n and outputs the value
    10·1 answer
  • Consider the code fragment below (with nested loops). int sum = 0;for (int i = 1; i &lt; 5; i++) for (int j = 1; j &lt;= i; j++)
    15·1 answer
  • The voluntary linkage of computer networks around the world is called the ______.
    7·1 answer
  • What is the definition of Overflow Error?
    5·1 answer
  • Write and test a Python program to find and print the largest number in a set of real (floating point) numbers. The program shou
    5·1 answer
  • PLEASE ANSWER THIS ASAP‼️
    10·2 answers
  • Computing devices translate digital to analog information in order to process the information
    12·1 answer
  • Which focal length and aperture combination is most likely to give you a deep depth of field?
    11·1 answer
  • Anyone who do bug bounty hunt ?​
    10·1 answer
  • Examples of ________, which is hosted on a web site, include e-mail, word processing, tax preparation, and game programs.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!