java
文章平均质量分 62
谷莠之
大·白·菜
展开
-
转:java socket通信(读取URL)
import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.File;import java.io.FileWriter;import java.io.InputStreamReader;import java.net.URL;public class URLReader {/*** @par转载 2015-02-05 15:56:24 · 849 阅读 · 0 评论 -
Java Performance Tips
Every little things add up. The overall performance of an application depends on the individual performance of its components. Here we list some of the Java programming tips to help your application转载 2016-05-08 21:20:41 · 595 阅读 · 0 评论 -
Class and object initialization-part2
Page 2 of 4After studying ClassInitializationDemo4's source code, you might wonder how useful class block initializers are. After all, you could easily move all code from ClassInitializationDemo4'转载 2016-05-19 11:56:46 · 591 阅读 · 0 评论 -
Class and object initialization-part1
This article marks a milestone in Java 101's exploration of client-side Java, as well as the one year anniversary of the series. Jeff begins moving away from simpler Java language concepts toward more转载 2016-05-19 11:54:40 · 685 阅读 · 0 评论 -
Java字符串编码与解码
Java.nio.包用Charset类统一对字符集进行转换。字符集建立了两个Unicode码元序列与使用本地字符编码方式的字节序列之间的映射。可以通过调用静态的forName方法来获得一个Charset,只需要向这个方法传递一个官方字符集名字或它的别名:Charset cset=Charset.forName("UTF-8");当本地编码方式模式不能表示所有的Unicode字符,如果某个字符不能表原创 2016-05-16 16:40:24 · 1008 阅读 · 0 评论 -
HashMap how to work
There are four things we should know about before going into internals of how HashMap works -HashMap works on the principal of hashing.Map.Entry interface - This interface gives a map entry (key-v转载 2016-05-03 15:13:59 · 328 阅读 · 0 评论 -
How HashMap works in java
Most common interview questions are “How HashMap works in java”, “How get and put method of HashMap work internally”. Here I am trying to explain internal functionality with an easy example. Rather th转载 2016-05-03 14:54:44 · 453 阅读 · 0 评论 -
Part 4 The Principles of Java Application Performance Tuning
This is the fifth article in the series of "Become a Java GC Expert". In the first issue Understanding Java Garbage Collection we have learned about the processes for different GC algorithms, about转载 2016-05-02 14:52:20 · 620 阅读 · 0 评论 -
Part 3 How to Tune Java Garbage Collection
This is the third article in the series of "Become a Java GC Expert". In the first issue Understanding Java Garbage Collection we have learned about the processes for different GC algorithms, about转载 2016-05-02 14:46:05 · 657 阅读 · 0 评论 -
Part 2 How to Monitor Java Garbage Collection
This is the second article in the series of "Become a Java GC Expert". In the first issue Understanding Java Garbage Collection we have learned about the processes for different GC algorithms, about转载 2016-05-02 14:27:33 · 672 阅读 · 0 评论 -
Part 1 Understanding Java Garbage Collection
What are the benefits of knowing how garbage collection (GC) works in Java? Satisfying the intellectual curiosity as a software engineer would be a valid cause, but also, understanding how GC works转载 2016-05-02 14:11:29 · 486 阅读 · 0 评论 -
Java8:读取文件到一个字符串
import java.io.IOException;import java.nio.file.Files;import java.nio.file.Paths; public static void main(String[] args) throws IOException { String content = new String(Files.readAllBy原创 2016-04-29 01:18:13 · 1990 阅读 · 0 评论 -
java中正确重写equals方法
hashCode()和equals()方法,定义在Object类中,这个类是所有类的基类,所以所有的java类都继承了这两个方法。 hashCode()方法用来给对象获取唯一的一个整数。这个整数被存储在HashTable类似的结构中的位置。默认的,Object类的hashCode()方法返回这个对象存储的内存地址的编号。 重写equals()方法必须要重写hashC原创 2016-04-29 14:31:17 · 18455 阅读 · 0 评论 -
写一个字符串到文件
import java.io.IOException;import java.nio.file.Files;import java.nio.file.Paths;public class StringToFile { public static void main(String[] args) throws IOException { String msg = "h原创 2016-04-29 01:32:00 · 474 阅读 · 0 评论 -
Good Java idioms
原文链接There are some things about programming in Java that are not obvious just by learning from the language specification or standard API documentation. In this document I will try to collect th转载 2016-04-29 00:59:37 · 685 阅读 · 0 评论 -
Class and object initializationpart-3
Page 3 of 4int second = 1 + first; can legally refer to first because first's declaration precedes second's declaration. However, it is illegal for int forwardReference = first; to refer to fi转载 2016-05-19 12:02:47 · 444 阅读 · 0 评论