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]
3 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]3 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
What can be defined as in information technology environment?
natka813 [3]
Here is your answer

7 0
3 years ago
Read 2 more answers
Which software-development methodology would be best if an organization needed to develop a software tool for a small group of u
xxTIMURxx [149]
I think prototyping model is best
3 0
2 years ago
When admitting digital evidence at trial, the issue of ________ comes up when the evidence involves computer-generated records.
kari74 [83]

Answer:

When admitting digital evidence at trial, the issue of <u>Authenticity</u> comes up when the evidence involves computer-generated records.

Explanation:

The digital evidence such as video, audio or some pictures have been presented before court as evidence. The first question that may arise is related to "authenticity of the material". To authenticate that evidence court may order the forensic audit of that particular evidence.

<em>So, the issue of authenticity of evidence will arise, in case of digital evidence.</em>

5 0
3 years ago
An IT security threat is anything that might cause serious harm to a computer system.
Blababa [14]

Answer:

True

Explanation:

this is true because a threat can endanger the computer and its system

5 0
2 years ago
Import java.awt.GridLayout;
Vikki [24]

Answer:

public class ConversionCalculator extends JFrame {

  private JLabel inch_Label, meter_Label, cm_Label, yard_Label;

  private JButton clear, calculate, exit;

  private JTextField inch_tf, cm_tf, meters_tf, yards_tf;

 

  public ConversionCalculator()

  {

     

      exitButtonHandler exitB;

      clearButtonHandler clearB;

      calcButtonHandler calcB;

     

      setTitle("Conversion Calculator");

      setSize(600,200);

      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

     

      //The first layout we use will be 1 row with three columns

      setLayout(new GridLayout(1,3));

     

      //initialize all the components

      inch_Label = new JLabel("Inches");

      meter_Label = new JLabel("Meters");

      cm_Label = new JLabel("Centimeters");

      yard_Label = new JLabel("Yards");

      clear = new JButton("Clear");

      calculate = new JButton("Calculate");

      exit = new JButton("Exit");

      inch_tf = new JTextField("0.00");

      cm_tf = new JTextField("0.00");

      meters_tf = new JTextField("0.00");

      yards_tf = new JTextField("0.00");

 

      JPanel panel1 = new JPanel();

      panel1.setLayout(new GridLayout(2,2));

      JPanel panel2 = new JPanel();

      panel2.setLayout(new GridLayout(2,2));

      JPanel panel3 = new JPanel();

      panel3.setLayout(new GridLayout(3,1));

      panel1.add(cm_Label);

      panel1.add(cm_tf);

      panel1.add(meter_Label);

      panel1.add(meters_tf);

     

      panel2.add(inch_Label);

      panel2.add(inch_tf);

      panel2.add(yard_Label);

      panel2.add(yards_tf);

     

      panel3.add(clear);

      panel3.add(calculate);

      panel3.add(exit);

     

      add(panel1);

      add(panel2);

      add(panel3);

     

     

      exitB = new exitButtonHandler();

      exit.addActionListener(exitB);

     

      clearB = new clearButtonHandler();

      clear.addActionListener(clearB);

     

      calcB = new calcButtonHandler();

      calculate.addActionListener(calcB);

     

      setVisible(true);

  }

 

  //public static void main(String[] args)

     // {

       // new ConversionCalculator();

      //}

 

  private class exitButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          //exits program

          System.exit(0);

      }

  }

 

  private class clearButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          //clear button sets all text fields to 0

          inch_tf.setText("0.00");

          meters_tf.setText("0.00");

          yards_tf.setText("0.00");

          cm_tf.setText("0.00");

      }

  }

 

  private class calcButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          double inches, yards, meters, cms;

          DecimalFormat df = new DecimalFormat("0.00");

         

          //parse strings in textbox into doubles

          inches = Double.parseDouble(inch_tf.getText());

          yards = Double.parseDouble(yards_tf.getText());

          meters = Double.parseDouble(meters_tf.getText());

          cms = Double.parseDouble(cm_tf.getText());

         

          //we check which value has been tampered with and base our conversion off this

          //because of this it is important that the user clears, or else it will do inch conversion

          if(inches != 0.00)

          {

              cms = inches * 2.54;

              meters = cms / 100;

              yards = inches / 36;

             

              cm_tf.setText(df.format(cms));

              meters_tf.setText(df.format(meters));

              yards_tf.setText(df.format(yards));

             

          }

          else if(yards != 0.00)

          {

              inches = yards / 36;

              cms = inches * 2.54;

              meters = cms / 100;

             

              cm_tf.setText(df.format(cms));

              meters_tf.setText(df.format(meters));

              inch_tf.setText(df.format(inches));

          }

          else if(meters != 0.00)

          {

              cms = meters * 100;

              inches = cms / 2.54;

              yards = inches / 36;

             

              cm_tf.setText(df.format(cms));

              inch_tf.setText(df.format(inches));

              yards_tf.setText(df.format(yards));

          }

          else if(cms != 0.00)

          {

              inches = cms / 2.54;

              yards = inches / 36;

              meters = cms / 100;

             

              meters_tf.setText(df.format(meters));

              inch_tf.setText(df.format(inches));

              yards_tf.setText(df.format(yards));

          }

      }

  }

}

Explanation:

  • Inside the action performed method, pass the strings in text box.
  • check if the value has been modified then do the relevant conversions inside the conditional statement.
  • When the user clears, it will not do to the inch conversion.
8 0
2 years ago
Other questions:
  • Generally speaking, manufacturing overhead is applied to production by means of a __________ __________ __________, which is com
    11·2 answers
  • A _______________ is a security threat that may launch a worm through a Trojan horse or launch a denial-of-service attack at a t
    10·1 answer
  • Default tab stops are set in word every _______ inch. a. ¾ b. ½ c. 1 d. ¼
    7·1 answer
  • Which of these trade-offs occur in a memory hierarchy?
    15·1 answer
  • I like the impact that the increasing number of social grants may have on the things mothers​
    14·1 answer
  • When a program is adapted to run on multiple processors in a multiprocessor system, the execution time on each processor is comp
    10·1 answer
  • A(n) ________ cloud does not free an organization from the issues associated with managing the cloud infrastructure, but it does
    7·1 answer
  • Which of the following are the most important reasons people in the 1920s were so interested in seeing lifelike stories in audio
    6·1 answer
  • When must an Assured Equipment Grounding Conductor Program (AEGCP) be in place?
    13·1 answer
  • I dont know how to put the negative sigh on my computer
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!