JAVA相关
水滴石穿2015
水滴石穿,非一日之功。
展开
-
【Java多线程】之二:Java Thread Sleep Example
java.lang.Thread sleep() method can be used to pause the execution of current thread for specified time in milliseconds. The argument value for milliseconds can’t be negative, else it throws IllegalArg转载 2015-08-09 09:53:14 · 372 阅读 · 0 评论 -
【JAVA面试题】之二:Java RandomAccessFile用法
《JAVA面试宝典》中6.3提到了RandomAccessFile,顺便看了下,摘抄如下:文章: http://blog.csdn.net/akon_vm/article/details/7429245 说明RandomAccessFile的绝大多数功能,但不是全部,已经被JDK 1.4 RandomAccessFile可以用在断点续传功能上。文章:http:/转载 2015-09-26 19:40:41 · 474 阅读 · 0 评论 -
【Java基础之二】JDK中使用到的23个经典设计模式
JDK中使用到的23个经典设计模式转载 2016-03-02 22:00:54 · 664 阅读 · 0 评论 -
【Java基础之四】Java集合类
1. Java集合类基本概念在编程中,常常需要集中存放多个数据。从传统意义上讲,数组是我们的一个很好的选择,前提是我们事先已经明确知道我们将要保存的对象的数量。一旦在数组初始化时指定了这个数组长度,这个数组长度就是不可变的,如果我们需要保存一个可以动态增长的数据(在编译时无法确定具体的数量),Java的集合类就是一个很好的设计方案了。集合类主要负责保存、盛装其他数据,因此集合类也被称为容器类。所有的转载 2016-12-20 15:14:47 · 366 阅读 · 0 评论 -
【Java多线程】之十三:Java Callable Future Example
In last few posts, we learned a lot about java threads but sometimes we wish that a thread could return some value that we can use. Java 5 introduced java.util.concurrent.Callable interface in concurre转载 2015-08-09 19:01:45 · 310 阅读 · 0 评论 -
【Java基础之一】Java Classloader机制解析
文章1举例说明了Classloader的加载顺序以及反射的应用等。文章2说明:loadClass方法:没有被标记为final,也就意味着我们是可以override这个方法的,也就是说双亲委托机制是可以打破的。findClass方法:在写自己的ClassLoader的时候,如果想遵循双亲委托机制,则只需要override findClass。假如我们自己写了一转载 2015-09-19 14:09:58 · 286 阅读 · 0 评论 -
【JAVA面试题】之一:第几行的obj符合垃圾收集器的收集标准?
《JAVA程序员面试宝典》86页,一道选择题,不太明白答案,望指教,题目是这样的:下列代码中,第几行的obj符合垃圾收集器的收集标准?1.Object aobj = new Object();2.Object bobj = new Object();3.Object cobj = new Object();4.aobj = bobj;5.aobj = cobj;6.cobj转载 2015-09-22 22:30:54 · 1918 阅读 · 0 评论 -
【Java基础之五】Java中IO详解
Java IO简介Java IO使用场景12 按是否格式化输出分13 按是否要缓冲分14 按数据格式分15 按输入输出分16 特殊需要Java IO分类Java IO举例1 文件2 字节流21 输入流InputStream22 输出流OutputStream23 输入输出流DataInputStreamDataOutputStream24 PushbackInputStre转载 2017-03-18 12:10:06 · 740 阅读 · 0 评论 -
【Java多线程】之九:守护线程
When we create a Thread in java, by default it’s a user thread and if it’s running JVM will not terminate the program. When a thread is marked as daemon thread, JVM doesn’t wait it to finish and as soo转载 2015-08-09 13:01:30 · 344 阅读 · 0 评论 -
【Java多线程】之八:单例模式的线程安全
Singleton is one of the most widely used creational design pattern to restrict the object creation by applications. In real world applications, resources like Database connections or Enterprise Informa转载 2015-08-09 12:32:13 · 384 阅读 · 0 评论 -
【Java多线程】之一:Thread Simple Example
Processes and Threads are two basic units of execution. Java concurrency programming is more concerned with threads.ProcessA process is a self contained execution environment and it can be seen as a pr转载 2015-08-08 22:59:27 · 510 阅读 · 0 评论 -
【Java多线程】之五:wait, notify and notifyAll
The Object class in java contains three final methods that allows threads to communicate about the lock status of a resource. These methods are wait(), notify() and notifyAll().The current thread which转载 2015-08-09 10:47:14 · 638 阅读 · 0 评论 -
【Java多线程】之七:死锁例子
Deadlock is a programming situation where two or more threads are blocked forever, this situation arises with at least two threads and two or more resources. Here I have written a simple program that w转载 2015-08-09 12:03:17 · 384 阅读 · 0 评论 -
【Java多线程】之十四:Java FutureTask Example Program
Sometime back I wrote a post about Java Callable Future interfaces that we can use to get the concurrent processing benefits of threads as well as they are capable of returning value to the calling pro转载 2015-08-09 19:29:27 · 390 阅读 · 0 评论 -
【Java多线程】之十:Timer and TimerTask
When we create a Thread in java, by default it’s a user thread and if it’s running JVM will not terminate the program. When a thread is marked as daemon thread, JVM doesn’t wait it to finish and as soo转载 2015-08-09 16:36:14 · 395 阅读 · 0 评论 -
【Java多线程】之十一:Java BlockingQueue Example implementing Producer Consumer Problem
java.util.concurrent.BlockingQueue is a Queue that supports operations that wait for the queue to become non-empty when retrieving and removing an element, and wait for space to become available in the转载 2015-08-09 17:14:59 · 363 阅读 · 0 评论 -
【Java多线程】之十二:Java Thread Pool Example using Executors and ThreadPoolExecutor
A thread pool manages the pool of worker threads, it contains a queue that keeps tasks waiting to get executed.A thread pool manages the collection of Runnable threads and worker threads execute Runnab转载 2015-08-09 18:37:59 · 282 阅读 · 0 评论 -
【Java多线程】之三:Java Thread Join Example
Java Thread join method can be used to pause the current thread execution until unless the specified thread is dead. There are three overloaded join functions.public final void join(): This method puts转载 2015-08-09 10:05:40 · 459 阅读 · 1 评论 -
【Java多线程】之四:Life Cycle of Thread
Understanding Life Cycle of Thread and Thread States are very important when you are working with Threads and programming for multi-threaded environment.As we learned in last tutorial, we can create a转载 2015-08-09 10:13:25 · 867 阅读 · 0 评论 -
【Java多线程】之六:Synchronization and Thread Safety
Java provide multi-threaded environment support using Java Threads, we know that multiple threads created from same Object share object variables and this can lead to data inconsistency when the thread转载 2015-08-09 11:49:10 · 528 阅读 · 0 评论 -
【Java基础之三】Java序列化
一序列化简介二序列化简单例子三序列化算法四影响序列化因素1 transient关键字2 writeObject方法与readObject方法3 Externalizable接口五单例模式序列化-readResolve六参考文献一、序列化简介序列化是一种对象持久化的手段。普遍应用在网络传输、RMI(Remote Method Invocation)等场景中。Java提供了一种对象序列原创 2016-12-18 16:58:40 · 348 阅读 · 0 评论