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
snow_tiger [21]
3 years ago
14

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

{ System.out.println("Welcome to Java"); int i = 0; int y = 2/i; System.out.println("Welcome to Java"); } catch (RuntimeException ex) { System.out.println("Welcome to Java"); } finally { System.out.println("End of the block"); } } }
Computers and Technology
1 answer:
Nataly [62]3 years ago
8 0

Answer:

This program will display "Welcome to Java" two times and then followed by "End of the block"

Explanation:

Here, the following program written in Java Programming Language.

Firstly, the class is defined "test" after that, the main method is defined "public static void main(String[ ] args)" then, set the try block and inside the try block print "Welcome to Java" then, two integer variable is declared "i" to 0 and "y" to 2/i then, again print "Welcome to Java" then close the try block.

Then, set the catch block and pass the exception "RuntimeException ex" inside the catch block again print "Welcome to Java" and close it.

Then, set finally block and inside it print "End of the block" and close it.

You might be interested in
What is decorator and how to use it wit Python programming language?
SCORPION-xisa [38]

Answer:

Decorators are very powerful and useful tool in Python since it allows programmers to modify the behavior of function or class. Decorators allow us to wrap another function in order to extend the behavior of wrapped function, without permanently modifying it.

Explanation:

5 0
3 years ago
Write a program that reads in exam scores and displays the average score and the high score You should first ask the user how ma
Furkat [3]

Answer:

exams = []

quantity = int(input('How many exams? '))

for i in range(quantity):

 exams.append(float(input('Enter a score: ')))

print('Average score: ',sum(exams)/len(exams))

print('High score: ', max(exams))

Explanation:

Step 1 define variables

exams = []

Step 2 get the quantity of scores(user input)

quantity = int(input('How many exams? '))

Step 3 loop over the quantity of exams and input the score and save it in an array

for i in range(quantity):

 exams.append(float(input('Enter a score: ')))

Step 4 show the results

print('Average score: ',sum(exams)/len(exams))

print('High score: ', max(exams))

Functions used:

sum: get the summarize of the array

len: get the quantity of elements in an array

max: get the max value in an array

5 0
3 years ago
What statement best describes operating systems?
True [87]

Answer:

An operating system, or "OS," is software that communicates with the hardware and allows other programs to run

3 0
3 years ago
Read 2 more answers
Where can I find the internet plug on my desktop computer?
Anna007 [38]
On the back of the computer
4 0
3 years ago
Read 2 more answers
Wi-fi refers to a network that is based on the ____ standard
Reil [10]

Answer:

Wi-fi refers to a network that is based on the 802.11 standard.

5 0
3 years ago
Read 2 more answers
Other questions:
  • You would like to create a graph that shows how much of your total investments are in stocks, savings, and mutual funds. You sho
    5·2 answers
  • Describe the effect of a pull up resistor
    7·1 answer
  • A persons decision to take action without being asked is
    9·1 answer
  • If you need help with a topic that isn't present in English or math labs, what should you do?
    13·2 answers
  • What components are in hard drives?
    12·1 answer
  • SATCOM in the Ku- and Ka- bands, as well as EHF systems are adversely affected by rain (the higher the frequency, the greater th
    14·1 answer
  • On the 80x86 CPU, the ESP register keeps track of the value on the top of the runtime stack.
    11·1 answer
  • hen a computer user stored data in computer memory, it required 1,024 bytes. How many KB does this represent?
    8·1 answer
  • Can someone please help me
    15·1 answer
  • True or False. The 'C' programming language guarantees that R0 will always contain a zero value on the ATmega328P
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!