上一页 1 2 3 4 5 6 ··· 9 下一页
摘要: 1. 安全问题产生原因多个线程操作共享数据。操作共享数据的线程代码有多条。当一个线程在执行操作共享数据的多条代码过程中,其他线程参与了计算,就会产生线程安全问题。2. 解决方案java中用同步代码块将需要同步的代码封装起来,即可解决这个问题。synchorized(obj){同步代码块;}好处:解决... 阅读全文
posted @ 2015-07-22 23:21 华科小涛 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 1. 继承Thread类定义类继承Thread类。覆盖run方法。实例化子类对象,调用start()方法,从而调用run方法。2.实现Runnable接口定义类实现Runnable接口。覆盖接口中的run方法,将线程的任务代码封装到run方法中。通过Thread类创建线程对象,并将Runnable接... 阅读全文
posted @ 2015-07-22 22:26 华科小涛 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊n/2⌋ times. You may assume that the array is non-empty and the majority element always exist in the array. 阅读全文
posted @ 2015-07-19 16:47 华科小涛 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Simple add() method is used for adding an element at the end of the list however there is another variant of add method which is used for adding an element to the specified index. 阅读全文
posted @ 2015-07-19 11:23 华科小涛 阅读(972) 评论(0) 推荐(0) 编辑
摘要: 分成两个部分:1.下载安装jdk,并配置环境变量链接:http://www.runoob.com/java/java-environment-setup.html2.安装Eclipse链接:http://www.runoob.com/eclipse/eclipse-install.html 阅读全文
posted @ 2015-07-18 16:55 华科小涛 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Exceptions in Java provide a consistent mechanism for identifying and responding to error conditions. Effective exception handling will make your programs more robust and easier to debug. 阅读全文
posted @ 2015-07-18 16:45 华科小涛 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 1.java异常层次结构:粉红色的是已检查异常(checked exceptions),其必须被 try{}catch语句块所捕获,或者在方法签名里通过throws子句声明.已检查异常必须在编译时被捕捉处理,命名为 CHecked Exception 是因为Java编译器要进行检查,Java虚拟机也... 阅读全文
posted @ 2015-07-17 23:11 华科小涛 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 1.static 关键字修饰的成员被所有对象共享(包括成员变量和方法)。修饰的成员优先于对象存在。存储于方法区(共享数据区)的静态区中。静态方法只能访问静态成员。静态方法中不可以使用this或super关键字。主函数是static,只能调用static方法。静态代码块随着类的加载而运行(只执行一次)... 阅读全文
posted @ 2015-07-13 22:19 华科小涛 阅读(740) 评论(1) 推荐(0) 编辑
摘要: 本文参考《算法导论》,整理者:华科小涛@http://www.cnblogs.com/hust-ghtao/ 归并排序时间复杂度:,非原址排序。 归并排序和快速排序一样,都遵循分治模式: 分解:分解待排序的 n 的元素的序列各具 n/2 个元素的两个序列。 解决:使用递归排序递归... 阅读全文
posted @ 2015-05-09 17:08 华科小涛 阅读(257) 评论(0) 推荐(0) 编辑
摘要: Python中字符串格式化符号及其含义。 阅读全文
posted @ 2015-04-05 16:05 华科小涛 阅读(486) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 9 下一页