Difference between revisions of "Java/C3/Custom-Exceptions/English"
(Created page with "'''Title of script:''' Custom Exceptions '''Author:''' Joms Antony '''Keywords:''' Custom Exceptions, User defined exceptions, throw keyword, throws keyword, video tutorial,...") |
Nancyvarkey (Talk | contribs) |
||
Line 12: | Line 12: | ||
|- | |- | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| '''Slide 1''' | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| '''Slide 1''' | ||
− | |||
Line 23: | Line 22: | ||
* '''Custom exceptions''' | * '''Custom exceptions''' | ||
− | * Usage of '''throw''' and '''throws''' | + | * Usage of '''throw''' and '''throws keywords''' |
− | + | ||
− | + | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| In this tutorial we will learn about: | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| In this tutorial we will learn about: | ||
* '''Custom exceptions '''and | * '''Custom exceptions '''and | ||
− | * Usage of '''throw''' and '''throws''' | + | * Usage of '''throw''' and '''throws keywords''' |
− | + | ||
− | + | ||
|- | |- | ||
Line 41: | Line 36: | ||
* '''JDK 1 .7''' | * '''JDK 1 .7''' | ||
* '''Eclipse''' 4.3.1 | * '''Eclipse''' 4.3.1 | ||
− | |||
− | |||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| To record this tutorial, I am using | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| To record this tutorial, I am using | ||
Line 48: | Line 41: | ||
* '''JDK 1 .7 '''and | * '''JDK 1 .7 '''and | ||
* '''Eclipse 4.3.1 ''' | * '''Eclipse 4.3.1 ''' | ||
− | |||
− | |||
|- | |- | ||
Line 58: | Line 49: | ||
* Basic knowledge of '''Exceptions Handling''' | * Basic knowledge of '''Exceptions Handling''' | ||
* For relevant tutorials, please visit http://www.spoken-tutorial.org | * For relevant tutorials, please visit http://www.spoken-tutorial.org | ||
− | |||
− | |||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| To follow this tutorial, you must have basic knowledge of '''Exceptions Handling '''in''' Java.''' | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| To follow this tutorial, you must have basic knowledge of '''Exceptions Handling '''in''' Java.''' | ||
Line 70: | Line 59: | ||
* '''Custom exception''' is a user defined exception class. | * '''Custom exception''' is a user defined exception class. | ||
− | * It is usually created as checked exceptions. | + | * It is usually created as '''checked exceptions'''. |
− | * It is used to customize the exception according to user need. | + | * It is used to customize the '''exception''' according to user need. |
Line 81: | Line 70: | ||
* It is usually created as '''checked exceptions.''' | * It is usually created as '''checked exceptions.''' | ||
− | * It is used to customize the exception according to user need. | + | * It is used to customize the '''exception''' according to user need. |
− | + | ||
− | + | ||
|- | |- | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| In Eclipse IDE, create a project called '''CustomExceptionDemo ''' | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| In Eclipse IDE, create a project called '''CustomExceptionDemo ''' | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Now we will open''' eclipse''' and create a new | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Now we will open''' eclipse''' and create a new '''project''' called''' CustomExceptionDemo.''' |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | Inside this '''project''' we will create the necessary '''classes''' to demonstrate '''custom exceptions.''' | ||
|- | |- | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Right click on '''src''' folder and click '''New'''-> '''Class '''and type the class name as '''InvalidMarkException''' and hit '''Enter''' | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Right click on '''src''' folder and click '''New'''-> '''Class '''and type the class name as '''InvalidMarkException''' and hit '''Enter''' | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| We will create a new '''class InvalidMarkException.''' | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| We will create a new '''class InvalidMarkException.''' | ||
− | |||
− | |||
− | |||
|- | |- | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| '''public | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| '''public class InvalidMarkException ''' |
Type | Type | ||
− | '''extends | + | '''extends Exception''' |
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| To make this as a type of '''exception''' | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| To make this as a type of '''exception class''', it should be a '''subclass''' of '''Java exception class'''. |
− | To do so, type''' extends | + | To do so, type''' extends Exception'''. |
|- | |- | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Click on '''Source''' -> '''Generate constructors from Superclass''' | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Click on '''Source''' -> '''Generate constructors from Superclass''' | ||
− | |||
− | |||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Click on '''Source''' menu and then select '''Generate constructors from Superclass'''. | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Click on '''Source''' menu and then select '''Generate constructors from Superclass'''. | ||
− | |||
− | |||
− | |||
|- | |- | ||
Line 137: | Line 113: | ||
Highlight the inserted code | Highlight the inserted code | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Then select the constructor with a single string argument and click on '''OK''' button at the bottom. | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Then select the '''constructor''' with a '''single string argument''' and click on '''OK''' button at the bottom. |
− | This '''string''' | + | This '''string argument''' can be used to customize the message shown when this '''exception''' occurs. |
Line 147: | Line 123: | ||
|- | |- | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Right click on '''src''' folder and click '''New'''-> '''Class -> StudentMarks''' | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Right click on '''src''' folder and click '''New'''-> '''Class -> StudentMarks''' | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Let us add another class named '''StudentMarks.''' | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Let us add another '''class''' named '''StudentMarks.''' |
|- | |- | ||
Line 166: | Line 142: | ||
− | This class contains only one variable named '''marks.''' | + | This '''class''' contains only one '''variable''' named '''marks.''' |
− | This constructor initializes the value of '''marks.''' | + | This '''constructor''' initializes the value of '''marks.''' |
|- | |- | ||
Line 198: | Line 174: | ||
Highlight "'''Entry OK'''" | Highlight "'''Entry OK'''" | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Let us now add a method to validate the marks. | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Let us now add a '''method''' to validate the marks. |
Line 207: | Line 183: | ||
− | For this, we need to use the '''throw''' | + | For this, we need to use the '''throw keyword''' explicitly to throw a '''custom exception'''. |
Line 225: | Line 201: | ||
− | Highlight the “'''throws''' | + | Highlight the “'''throws InvalidMarkException”''' |
Line 232: | Line 208: | ||
− | We can see that the error disappears once the '''“throws InvalidMarkException”''' is added to the method signature. | + | We can see that the error disappears once the '''“throws InvalidMarkException”''' is added to the '''method signature.''' |
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
Line 241: | Line 214: | ||
'''public''' '''void''' validate() '''throws''' InvalidMarkException | '''public''' '''void''' validate() '''throws''' InvalidMarkException | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Here we can see that the '''throws''' | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Here we can see that the '''throws keyword''' is used along with '''methods'''. |
|- | |- | ||
Line 247: | Line 220: | ||
InvalidMarkException | InvalidMarkException | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| It indicates that the method will raise the specified exception. | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| It indicates that the '''method''' will raise the '''specified exception.''' |
|- | |- | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| '''throw''' '''new''' InvalidMarkException(marks+" not a valid entry"); | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| '''throw''' '''new''' InvalidMarkException(marks+" not a valid entry"); | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| We have to provide the exception handling code when such a method is called. | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| We have to provide the '''exception handling''' code when such a '''method''' is called. |
Line 260: | Line 233: | ||
'''FileReader fr=null;''' | '''FileReader fr=null;''' | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Next, let us perform a file access operation which will raise a '''FileNotFoundException'''. | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Next, let us perform a '''file access operation''' which will raise a '''FileNotFoundException'''. |
− | So type the following code to create an instance of a '''FileReader | + | So type the following code to create an instance of a '''FileReader class'''. |
|- | |- | ||
Line 314: | Line 287: | ||
Highlight '''throws''' InvalidMarkException, FileNotFoundException | Highlight '''throws''' InvalidMarkException, FileNotFoundException | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| We can see that '''FileNotFoundException''' is also added to the '''throws''' | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| We can see that '''FileNotFoundException''' is also added to the '''throws clause'''. |
− | We can handle multiple exceptions using '''throws''' as shown here. | + | We can handle multiple '''exceptions''' using '''throws''' as shown here. |
Line 336: | Line 309: | ||
} | } | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| We will now create the '''main''' | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| We will now create the '''main method''' inside the '''StudentMarks class''' and verify the results. |
Line 352: | Line 325: | ||
|- | |- | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Point the error | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Point the error | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| We can see that there is an error when the '''validate''' | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| We can see that there is an error when the '''validate method''' is invoked. |
− | It says that this method will raise the | + | It says that this '''method''' will raise the |
'''InvalidMarkException''' and '''FileNotFoundException''' | '''InvalidMarkException''' and '''FileNotFoundException''' | ||
− | |||
− | |||
− | |||
|- | |- | ||
Line 370: | Line 340: | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| To resolve the error, we can add '''throws''' | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| To resolve the error, we can add '''throws clause''' to '''main method''' as we did earlier |
− | But it is recommended to use '''try''' and '''catch | + | But it is recommended to use '''try''' and '''catch block.''' |
Line 379: | Line 349: | ||
− | Now the necessary '''try-catch blocks''' are added and the exception has been handled. | + | Now the necessary '''try-catch blocks''' are added and the '''exception''' has been handled. |
|- | |- | ||
Line 410: | Line 380: | ||
− | Since we have handled the exception, | + | Since we have handled the '''exception''', we can see the message “rest of the code” |
− | |||
− | + | Instead if we use '''“throws” clause''', this message “rest of the code” will not be printed. | |
− | Instead if we use “throws” clause, | + | |
− | + | ||
− | this message “rest of the code” will not be printed. | + | |
Line 423: | Line 389: | ||
− | So it is better to use a '''try catch block''' when a method is called inside the '''main''' | + | So it is better to use a '''try catch block''' when a '''method''' is called inside the '''main method'''. |
Line 437: | Line 403: | ||
− | * What is a Custom Exception | + | * What is a '''Custom Exception''' |
− | * Usage of throw and throws keywords | + | * Usage of '''throw''' and '''throws keywords''' |
− | * How to create and use custom exceptions | + | * How to create and use '''custom exceptions''' |
− | + | ||
− | + | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Let us summarize. | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Let us summarize. | ||
Line 447: | Line 411: | ||
In this tutorial we have learned about | In this tutorial we have learned about | ||
− | * What is a Custom Exception | + | * What is a '''Custom Exception''' |
− | * Usage of throw and throws keywords | + | * Usage of '''throw''' and '''throws keywords''' |
− | * How to create and use custom exceptions | + | * How to create and use '''custom exceptions''' |
− | + | ||
− | + | ||
|- | |- | ||
Line 459: | Line 421: | ||
− | * Create a custom exception class | + | * Create a '''custom exception class InvalidAgeException''' |
− | + | * Create another '''class Age''' and create a '''constructor''' to initialize the value of age | |
− | + | * Create '''validate() method''' to throw the above exception if age < 18 | |
− | * Create another | + | |
− | * Create validate() method to | + | |
Line 470: | Line 430: | ||
− | Create a custom exception class called '''InvalidAgeException''' | + | Create a '''custom exception class''' called '''InvalidAgeException''' |
− | Create another | + | Create another '''class Age''' and create a '''constructor''' to initialize the value of age |
− | Also create a | + | Also create a '''method validate''' to throw an '''exception''' if the age is less than 18 |
|- | |- | ||
Line 484: | Line 444: | ||
− | * | + | * Create objects inside the '''main method''' and invoke the '''validate() method''' |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | Provide exception handling using | + | * Provide '''exception handling''' using '''try-catch blocks''' |
− | ''' | + | * Verify the '''custom exception class ''' |
+ | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.173cm;padding-right:0.191cm;"| Create objects inside the '''main method''' and invoke the '''validate() method''' | ||
− | |||
+ | Provide '''exception handling''' using '''try-catch blocks''' wherever required. | ||
+ | Verify the '''custom exception class'''. | ||
|- | |- |
Latest revision as of 15:58, 16 June 2017
Title of script: Custom Exceptions
Author: Joms Antony
Keywords: Custom Exceptions, User defined exceptions, throw keyword, throws keyword, video tutorial, Java
|
|
Slide 1
|
Welcome to the spoken tutorial on custom exceptions. |
Slide 2
Learning Objectives
|
In this tutorial we will learn about:
|
Slide 3
Software Requirements
|
To record this tutorial, I am using
|
Slide 4
Prerequisites
|
To follow this tutorial, you must have basic knowledge of Exceptions Handling in Java.
If not, for relevant Java tutorials, please visit the link shown. |
Slide 5
Custom Exception
|
First let us learn about custom exceptions.
|
In Eclipse IDE, create a project called CustomExceptionDemo | Now we will open eclipse and create a new project called CustomExceptionDemo.
|
Right click on src folder and click New-> Class and type the class name as InvalidMarkException and hit Enter | We will create a new class InvalidMarkException. |
public class InvalidMarkException
Type extends Exception |
To make this as a type of exception class, it should be a subclass of Java exception class.
|
Click on Source -> Generate constructors from Superclass | Click on Source menu and then select Generate constructors from Superclass. |
Click on Deselect All
|
Now click on Deselect All button in the right hand side. |
Select Exception(String)
Click OK button.
|
Then select the constructor with a single string argument and click on OK button at the bottom.
|
Right click on src folder and click New-> Class -> StudentMarks | Let us add another class named StudentMarks. |
Copy the following code
int marks; public StudentMarks(int marks) { this.marks = marks; } Highlight “int marks;” Highlight “public StudentMarks(int marks) { this.marks = marks;}” |
Then type the following code.
This constructor initializes the value of marks. |
Copy the following code
public void validate() { if (marks<0 || marks>100)
else System.out.println("Entry OK"); }
Highlight “throw new InvalidMarkException(marks+" not a valid entry");”
|
Let us now add a method to validate the marks.
|
Highlight
throw new InvalidMarkException(marks+" is not a valid entry"); |
We can see that there is an error InvalidMarkException.
|
Click on the error and double click “Add throws declaration”
|
So click on the error and double click “Add throws declaration”.
|
Highlight
public void validate() throws InvalidMarkException |
Here we can see that the throws keyword is used along with methods. |
Highlight
InvalidMarkException |
It indicates that the method will raise the specified exception. |
throw new InvalidMarkException(marks+" not a valid entry"); | We have to provide the exception handling code when such a method is called.
|
Next to System.out.println("Entry OK"); statement, type
FileReader fr=null; |
Next, let us perform a file access operation which will raise a FileNotFoundException.
|
Point the error
|
Eclipse will show some errors as we have not imported the corresponding Java packages.
|
fr=new FileReader(“/home/spoken/Marks");
|
To allow fr to access a file called Marks which is located in the home folder, type the following code.
|
Point the error
Click on the error and double click Add throws declaration
|
An error shows that this line of code can raise a FileNotFoundException.
|
Highlight FileNotFoundException
|
We can see that FileNotFoundException is also added to the throws clause.
|
Copy the following code
public static void main(String[] args) { StudentMarks m1=new StudentMarks(40);
} |
We will now create the main method inside the StudentMarks class and verify the results.
|
Highlight StudentMarks m1=new StudentMarks(40);
|
Here we create an object m1 initialized with 40 as the value for marks.
In the next line we invoke the method validate using the object m1. |
Point the error | We can see that there is an error when the validate method is invoked.
InvalidMarkException and FileNotFoundException |
Point to throws in the drop down options
|
To resolve the error, we can add throws clause to main method as we did earlier
|
Click run icon | Now let us run this program. |
Point to Entry OK, rest of the code | It displays “Entry OK” and “rest of the code”.
|
Modify “Marks m1=new Marks(-10);” | Let us now change the value to -10 which is an invalid entry. |
Click run icon | We will run the program again. |
Highlight the output
InvalidMarkException: -10 is not a valid entry
|
Now we can see that the InvalidMarkException is thrown as -10 is an invalid entry.
|
Slide 8
Summary
|
Let us summarize.
|
Slide 9
Assignment
|
As an assignment
|
Slide 9A
Assignment
|
Create objects inside the main method and invoke the validate() method
|
About Project
(retain the slide as in TEX file) |
The video at the following link summarizes the Spoken Tutorial Project.
|
About Workshops
(retain the slide as in TEX file) |
The Spoken Tutorial Project Team
• Conducts workshops using spoken tutorials and • Gives certificates on passing the online tests
|
About NMEICT
(retain the slide as in TEX file) |
Spoken Tutorial Project is funded by the NMEICT, MHRD, Government of India.
|
Contributor slide
(retain the slide as in TEX file) |
This script has been contributed by:
Department of Information Technology, Amal Jyothi College of Engineering
|