惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
D
DataBreaches.Net
F
Full Disclosure
腾讯CDC
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
J
Java Code Geeks
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy International News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CERT Recently Published Vulnerability Notes
O
OpenAI News
Project Zero
Project Zero
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
Schneier on Security
Schneier on Security

博客园 - chance_win

感觉日子变苦了 工作了,就不要在象个孩子 成长的点滴 跨平台和可移植的区别 人生的又一个转折 每个人都应该是善良的 终于得了特等奖 aip团队开通--一个值得纪念的日子 学习敏捷开发 第一次见客户 第一次见客户--尴尬的一天 《C#程序员参考手册》 《effictive java》 《敏捷软件开发-原则、模式与实践》 《OOD启示录》 《JAVA与模式》 说给我的学生们 读《.NET本质论》样章有感 .NET程序员们都在干什么?
关于.NET下异常的问题
chance_win · 2005-05-27 · via 博客园 - chance_win

刚才在书上看到了一个介绍异常的代码,程序如下:

 1using System;
 2using System.IO;
 3
 4public class ExceptionDemo
 5{
 6 public static void Main()
 7 {
 8  StreamWriter sw = null;
 9
10  try
11  {
12   sw = new StreamWriter(new FileStream("Area.txt",FileMode.Open));
13   sw.WriteLine("Hello there");
14  }

15  catch(FileNotFoundException fnfe)
16  {
17   Console.WriteLine("djslfjdsfj");
18  }

19  catch(Exception e)
20  {
21   Console.Write(e);
22  }

23  finally
24  {
25   if(sw != null)
26   {
27    sw.Close();
28   }

29  }

30 }

31}

32

有一个问题想问问,在书上说可以不在catch后的括号内指定异常类型和变量名,如果不指定就意味着使用所有异常类的基类,也就是Exception类,但是我将第19行catch括号中的类型名和变量名去掉后,编译不过,这是为什么呢?希望得到大家的帮助。谢谢