ITeye博客

java/corejava

共 9 篇文章

用java发送http请求

一种方式是用开源组件httpclient 另一种是用jdk自带的类,下面只说下自带类的用法: package test; import java.io.IOException; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.URL; public class Test { public static void main(String[] args) throws IOException { URL url = new URL("http://localhost:808…

2011-04-22 09:54 · java/corejava

【翻译】Serialization / Marshalling / Deflating in JAVA

原文地址: http://www.dzone.com/links/r/serialization_marshalling_deflating_in_java.html Writing Java Objects or keeping the state of Objects into DataBase or Files (In Binary Format) is known as Serialization or Marshalling or deflating. Reading Java Objects back in Binary Format from file or Database …

2011-03-14 10:52 · java/corejava

【翻译】10 Interview questions on Singleton Pattern in Java

原文地址: http://www.dzone.com/links/r/top_10_interview_questions_on_singleton_pattern_i.html Singleton pattern is one of the most common patterns available and it’s also used heavily in Java. This is also one of my favorite interview question and has lots of interesting follow-up to digg into details …

2011-03-14 10:49 · java/corejava

【翻译】Hello World with Apache Commons Digester

原文地址: http://kushanxp.blogspot.com/2011/02/hello-world-with-apache-commons.html This example will shows how to get started with Apache Commons Digester. What is Apache Commons Digester? Simply, you can use this to read a XML file against a particular pattern (say, particular tag in XML file) and if…

2011-03-03 13:46 · java/corejava

【翻译】Hello World with Java Architecture for XML Binding - JAXB

原文地址: http://kushanxp.blogspot.com/2011/03/hello-world-with-java-architecture-for.html What is JAXB? JAXB (Java Architecture for XML Binding) facilitates you to read or write to a XML file. since XML involves with Java everywhere, It will be very useful when working with Java. Here I'm assuming you…

2011-03-03 13:24 · java/corejava

【翻译】Abstract Classes Have Constructors

In Java , we have default constructors provided for classes by the compiler (in case one is not declared). The abstract classes can't be instantiated by using the new operator because they don't provide full implementation of all the methods. Then does it make sense to have constructors inside abst…

2011-02-28 12:59 · java/corejava

【翻译】Why String is immutable in Java

原文地址: http://javarevisited.blogspot.com/2010/10/why-string-is-immutable-in-java.html This is one of the most popular interview question on String in Java which starts with discussion of What is immutable object , what are the benefits of immutable object , why do you use it and which scenarios do y…

2011-02-28 11:27 · java/corejava

【翻译】java verbose options

原文链接: http://extreme-java.blogspot.com/2011/01/java-verbose-options-for-running.html There are basically three sub parameters with the javac verbose parameter: verbose参数有三个基本的子参数: -verbose:class -verbose:gc -verbose:jni To give you an idea of the number of classes loaded when you fire the java comm…

2011-02-28 09:53 · java/corejava

删除文件夹和统计文件夹大小

//删除文件夹 public static void fileDelete(File file) throws Exception { if (!file.exists()) { log.debug("文件或目录不存在!"); return; } if (file.isFile()) { if (!file.delete()) throw new Exception("文件无法删除!"); return; } if (file.isDirectory()) { File[] files = file.listFiles(); if (files.length == 0) { if (!fil…

2009-05-15 11:08 · java/corejava