Question

In: Economics

Explain the application of the Perfect Tender Rule and its exceptions. Discuss the following: Do these...

Explain the application of the Perfect Tender Rule and its exceptions. Discuss the following:

Do these exceptions make sense to you? Why or why not?

If you are purchasing goods and want to do your best to be certain that an exception does not apply, how can you protect yourself?

Solutions

Expert Solution

Exception handling is the process of responding to the occurrence, during computation, of exceptions – anomalous or exceptional conditions requiring special processing – often changing the normal flow of program execution.

Handling the exception is nothing but converting system error generated message into user friendly error message. Whenever an exception occurs in the java application, JVM will create an object of appropriate exception of sub class and generates system error message, these system generated messages are not understandable by user so need to convert it into user friendly error message. You can convert system error message into user friendly error message by using exception handling feature of java.
For Example: when you divide any number by zero then system generate / by zero so this is not understandable by user so you can convert this message into user friendly error message like Don't enter zero for denominator.

Provide a couple of examples of exceptions and why you would use them.

Exceptions are a wonderful aspect of programming languages because they allow you to notice when something has gone wrong and deal with it gracefully. Without exceptions your application would end up presenting errors to the user and it would be much more difficult to diagnose what went wrong if your code failed silently.

Unfortunately exceptions are usually not one of the first things you learn when you start to code. In fact, you probably pick up a lot of bad habits when learning how to deal with problems because exceptions can seem like a difficult concept to get your head around.

Exceptions are actually a really simple thing to learn and they will make your code better and your life as a developer easier. Once you understand what an exception is and when and how you should use them you will find using exceptions in your code becomes second nature.

Please provide an example of at least one checked and one unchecked exception?

checked exceptions:

Checked exceptions are checked at compile-time. It means if a method is throwing a checked exception then it should handle the exception using try-catch block or it should declare the exception using throws keyword, otherwise the program will give a compilation error.

Checked Exception Example

In this example we are reading the file myfile.txt and displaying its content on the screen. In this program there are three places where a checked exception is thrown as mentioned in the comments below. FileInputStream which is used for specifying the file path and name, throws FileNotFoundException. The read() method which reads the file content throws IOException and the close() method which closes the file input stream also throws IOException.

Unchecked exceptions:

Unchecked exceptions are not checked at compile time. It means if your program is throwing an unchecked exception and even if you didn’t handle/declare that exception, the program won’t give a compilation error. Most of the times these exception occurs due to the bad data provided by user during the user-program interaction. It is up to the programmer to judge the conditions in advance, that can cause such exceptions and handle them appropriately. All Unchecked exceptions are direct sub classes of RuntimeException class.

Why might you need a finally clause?

The finally clause is used to provide the capability to execute code no matter whether ornot an exception is thrown or caught.


Related Solutions

The UCC Perfect Tender Rule sets out certain options that the buyer of goods has if...
The UCC Perfect Tender Rule sets out certain options that the buyer of goods has if the delivery fails to conform to the contract. What are these options? What conditions must the buyer meet?
What is UBIT and what are some exceptions to the rule? Why do you think these...
What is UBIT and what are some exceptions to the rule? Why do you think these exceptions exist? Include tax policy considerations in your discussion. What is the significance of the “regularly carried on” test as it relates to UBIT?
Explain any THREE (3) exceptions to the nemo dat rule under the Sale of Goods Act...
Explain any THREE (3) exceptions to the nemo dat rule under the Sale of Goods Act 1957. ( 10 mark)
1. Explain the equity method with regards to the application of the 20 percent rule, is...
1. Explain the equity method with regards to the application of the 20 percent rule, is this always strictly applied? 2. Identify and explain the different types of classifications for investments in equity securities.
1) Which of the following is NOT true regarding the application of the Absolute Priority Rule...
1) Which of the following is NOT true regarding the application of the Absolute Priority Rule in the distribution of liquidation distributions? a) Secured creditors are not on the APR list as they are entitled to the proceeds from the sale of the secured assets. b) if an asset is sold and the proceeds are more than required to pay the secured creditors, the remainder of the funds go to pay unsecured creditors. c) If an asset is sold and...
Define 10 different “The right hand rule” first define the application and explain how the right...
Define 10 different “The right hand rule” first define the application and explain how the right hand rule is is applied to find the direction of physical concept . please answer clearly in details
After thoroughly reviewing the octet rule, respond to the following: Discuss the octet rule and why...
After thoroughly reviewing the octet rule, respond to the following: Discuss the octet rule and why there are exceptions to the rule. Give examples of the rule and of exceptions written in 250 words minimum
Discuss in detail the transition of a firm from perfect competition to monopolistic. Explain with a...
Discuss in detail the transition of a firm from perfect competition to monopolistic. Explain with a good example.
Choose 3 terms to any of the following below and give its application. Explain the procedure...
Choose 3 terms to any of the following below and give its application. Explain the procedure on how it’s done and explain why/how it is related to the term. - Magnetic Field - Magnetic Force - Bio Savart Law - Electrostatic Force -Electrostatic Field - Hall Effect - Mass Spectrometer
Discuss the use of transfer pricing and its application to decision making
Discuss the use of transfer pricing and its application to decision making
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT