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
kherson [118]
3 years ago
9

Write a program that illustrates rethrowing an exception. Define methods CISP401Method and CISP401Method2. Method CISP401Method2

should initially throw an exception. Method CISP401Method should call CISP401Method2, catch the exception and rethrow it. Call CISP401Method from method main, and catch the rethrown exception. Print the stack trace of this exception.

Computers and Technology
1 answer:
stepan [7]3 years ago
3 0

Answer:

See explaination

Explanation:

The code here:

import java.io.*;

public class CISP401V11A5 {

public static void main(String[] args) throws Exception {

try {

CISP401Method();

} catch (Exception e) {

System.out.println("Exception thrown in " + e.getStackTrace()[0].getMethodName() + "\n");

StringWriter sw = new StringWriter();

e.printStackTrace(new PrintWriter(sw));

String exceptionAsString = sw.toString();

String bagBegin = exceptionAsString.substring(0, 19);

String bagEnd = exceptionAsString.substring(19);

System.out.println(bagBegin + ": Exception thrown in " + e.getStackTrace()[0].getMethodName() + bagEnd);

}

}

public static void CISP401Method() throws Exception {

try {

CISP401Method2();

} catch (Exception e) {

throw e;

}

}

public static void CISP401Method2() throws Exception {

throw new Exception();

}

}

See attachment for sample output

You might be interested in
1 There are several applications to assist you to surf through the internet, mention
prohojiy [21]
Email
Web browsing
Peer-to-peer services
3 0
3 years ago
ASAP HELP
vovangra [49]

Answer:@the bottom slide

Explanation:wats ya email i

will help u

8 0
3 years ago
In your own words, explain at least one reason why programming languages have functions.
Nataly [62]
Programming languages have functions because, they are the set of operations that may be applied to objects of that particular class.
for an example I will attach a function, you just check it

brainliest pls

5 0
4 years ago
The most important form of nonverbal communication during a presentation is PowerPoint.
denis-greek [22]
It could also be eye contact
6 0
4 years ago
_____________ is fundamental rethinking and radical redesign of business processes. It helps achieve improvements in critical an
leva [86]

Answer:

Reengineering

Explanation:

: )

3 0
4 years ago
Other questions:
  • Go to the Creamy Ice Corporation passage on the next page. Insert the trademark sign after the word “Corporation'' in the first
    9·1 answer
  • Which of the following formats can algorithms NOT be written in:
    13·1 answer
  • Microsoft access does not create n:m relationships because microsoft access creates databases based on
    7·1 answer
  • (10 points) 5.12. Discuss how the following pairs of scheduling criteria conflict in certain settings. a. CPU utilization (effic
    9·1 answer
  • How is the internet made?
    7·1 answer
  • Apakah ada yang bisa menjelaskan potongan source code ini?
    15·1 answer
  • If String str = "Computer Science";, then what is the value of str.substring(10);? ​
    6·1 answer
  • In Python, which comparison operator means "less than or equal to"?
    5·2 answers
  • 3
    7·2 answers
  • A large retailer is asking each customer at checkout for their zip code. if the zip code is the only recorded variable, what is
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!