码迷,mamicode.com
首页 >  
搜索关键字:try    ( 12995个结果
关于SocketTcp通讯
/// /// 监听并返回数据 /// /// public static void TcpSocketReceive() { try { ...
分类:其他好文   时间:2015-04-03 18:49:15    阅读次数:161
重定向syste.out.print
PrintStream ps; try { ps = new PrintStream("D:\\role.txt"); System.setOut(ps); } catch (FileNotFoundException e) { e.printStackTrace(); }
分类:其他好文   时间:2015-04-03 13:14:07    阅读次数:138
你真的了解try{ return }finally{}中的return?
今天去逛论坛 时发现了一个很有趣的问题:谁能给我我解释一下这段程序的结果为什么是:2.而不是:3代码如下:class Test { public int aaa() { int x = 1; try { return ++x; } catch (Exception e) { } fina...
分类:其他好文   时间:2015-04-03 11:01:33    阅读次数:140
Android运行时识别API版本
1 /** 2 * 判断Android系统API的版本 3 * 4 * @return 5 */ 6 publicstaticint getAPIVersion(){ 7 intAPIVersion; 8 try{ 9 APIVersion=Integer.valueO...
分类:移动开发   时间:2015-04-03 10:52:28    阅读次数:144
C# winform 查找指定节点值
简单粗暴,直接上代码: XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load(Help.basePath); XmlNode root = xmlDoc.SelectSingleNode("//screenshot"); if (root != null) { ...
分类:Windows程序   时间:2015-04-03 09:39:52    阅读次数:145
C# winform 判断当前参数值与节点中的值是否一致
C# winform 判断当前参数值与节点中的值是否一致 public static bool CheckValues(string isscreenshot, string screenshottime, string screenshotsavepath) { try { bool flage = false; DataTable dt = ReturnTbByReradxml...
分类:Windows程序   时间:2015-04-03 09:39:52    阅读次数:154
C# winform 截屏代码
try { Image image = new Bitmap(width, height); Graphics g = Graphics.FromImage(image); g.CopyFromScreen(x, y, 0, 0, new System.Drawing.Size(width, height)); string hour = Dat...
分类:Windows程序   时间:2015-04-03 09:37:41    阅读次数:131
try判断是不是闰年
static void Main(string[] args) { while (true) { string rn = Console.ReadLine(); string s ...
分类:其他好文   时间:2015-04-03 09:11:36    阅读次数:111
判断年份
while (true) { Console.Write("请输入一个年份:"); string a = Console.ReadLine(); string b = ""; try { DateTime c = Convert.ToDateTime(a+"-2-29"); b="年是闰年"; } ...
分类:其他好文   时间:2015-04-03 09:08:32    阅读次数:133
POST中文转码问题
//在newStringEntity(params,"utf-8")指定为utf-8编码 try{ HttpClientclient=newDefaultHttpClient(); HttpPosthttpPost=newHttpPost(url); //设置编码,防止中文传输乱码 StringEntityentity=newStringEntity(contentValue.toString(),"utf-8"); httpPost.setEntity(entity);..
分类:其他好文   时间:2015-04-03 06:59:45    阅读次数:175
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!