Exception in main method : Exceptions « Language Basics « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Collections Data Structure
8. Database SQL JDBC
9. Design Pattern
10. Development Class
11. Email
12. Event
13. File Input Output
14. Game
15. Hibernate
16. J2EE
17. J2ME
18. JDK 6
19. JSP
20. JSTL
21. Language Basics
22. Network Protocol
23. PDF RTF
24. Regular Expressions
25. Security
26. Servlets
27. Spring
28. Swing Components
29. Swing JFC
30. SWT JFace Eclipse
31. Threads
32. Tiny Application
33. Velocity
34. Web Services SOA
35. XML
Microsoft Office Word 2007 Tutorial
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Java » Language Basics » ExceptionsScreenshots 
Exception in main method


// : c09:MainException.java
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.

import java.io.FileInputStream;

public class MainException {
  // Pass all exceptions to the console:
  public static void main(String[] argsthrows Exception {
    // Open the file:
    FileInputStream file = new FileInputStream("MainException.java");
    // Use the file ...
    // Close the file:
    file.close();
  }
///:~


           
       
Related examples in the same category
1. Illustrate various Exceptions Illustrate various Exceptions
2. Experience exceptionsExperience exceptions
3. StackTrace
4. What happens if a method declares an unchecked exception?
5. Simple demo of exceptionsSimple demo of exceptions
6. Simple demo of exceptions, with finally clauseSimple demo of exceptions, with finally clause
7. ThreadBasedCatcher - Demonstrate catching uncaught exceptions
8. Exception CatcherException Catcher
9. Turning off Checked exceptions
10. Demonstrates exception chainingDemonstrates exception chaining
11. Finally is always executedFinally is always executed
12. Demonstrating the Exception MethodsDemonstrating the Exception Methods
13. Further embellishment of exception classesFurther embellishment of exception classes
14. The finally clause is always executedThe finally clause is always executed
15. Your own Exception classYour own Exception class
16. Catching exception hierarchiesCatching exception hierarchies
17. How an exception can be lost
18. Ignoring RuntimeExceptionsIgnoring RuntimeExceptions
19. Demonstrating fillInStackTrace()Demonstrating fillInStackTrace()
20. Rethrow a different object from the one that was caughtRethrow a different object from the one that was caught
21. Inheriting your own exceptionsInheriting your own exceptions
22. Overridden methods may throw only the exceptions
23. Throw Exception OutThrow Exception Out
ww_w__._j_a__v__a___2s.__co__m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.