import java.net.*;//for URL
import java.io.*;//for catch (IOException e),File,InputStream, BufferedInputStream,and FileInputStream ect
public class HelloJava{
public static void main (String[] args){
Image image = null;
try {
// Read from a file
File sourceimage = new File("source.gif"); //source.gif图片要与HelloJava.java同在一目录下
image = ImageIO.read(sourceimage);
// Read from an input stream
InputStream is = new BufferedInputStream(
new FileInputStream("mid.jpg")); //mid.jpg图片要与HelloJava.java同在一目录下
image = ImageIO.read(is);
// Read from a URL
URL url = new URL("http://www.javaworld.com/images/012407-tipsbox.jpg");
image = ImageIO.read(url);
} catch (IOException e) {
}
}