自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 收藏
  • 关注

原创 打印一个目录,并以树形结构显示

import java.io.*;import java.util.*;public class VisualDirectory { private static int times; public static void deepList(File file) { if(file.isFile()||file.listFiles().length==0) { retur

2014-05-30 11:11:13 1016

原创 文件数据输入字节流的运用

import java.io.*;public class InputStreamTest { public static void main(String args[])throws IOException { FileInputStream filetest=new FileInputStream("c:/test.txt"); byte [] buffer=new byte[

2014-05-28 16:22:04 473

原创 运用递归的方式删除整个目录及其中的文件

import java.io.*;public class DeleteDirectory{ public void method(File file) { File[] f=file.listFiles(); for(File fil:f) { if(!fil.delete()) { this.method(fil); fil.delete();

2014-05-27 15:13:18 367

原创 Fibonacci数列的递归简单实现

public class Fibonacci { public int method(int x) { if(x==2||x==1) return 1; else return method(x-1)+method(x-2); } public static void main(String args[]) { Fibonacci fb=new Fib

2014-05-27 09:43:07 373

原创 迭代与递归的运用

public class FileTest6 { //迭代的方法进行计算 public int method(int x) { int s=1; for(int i=x;i>0;i--) { s=s*i; } return s; } public int method2(int number) { //使用递归的方法进行计算 if(number==1

2014-05-26 17:18:10 384

原创 File中几种方法的运用

import java.io.*;public class FileTest3 { public static void main(String args[]) { File file =new File("c:/KuGou"); System.out.println(file.isDirectory()); String []str=file.list(); for(St

2014-05-26 16:13:35 305

原创 创建File对象的几种形式

import java.io.File;import java.io.IOException;public class FileTest { public static void main(String args[]) throws IOException { File file=new File("c:\\test.txt");// System.out.println(

2014-05-26 11:15:07 1168

原创 使用匿名内部类定义窗口监听器

import javax.swing.*;import java.awt.*;import java.awt.event.*;public class InnerTest { public static void main(String args[]) { JFrame frame=new JFrame("JFrame"); JButton button=new JButton

2014-05-26 09:38:10 602

原创 四种不同的内部类的应用范畴

/*//静态内部类class Test{ private static int a=10; //public static void method(int x,int y) //{ // System.out.println(x+y); //} public static class MyTest { public void method() { System

2014-05-22 15:16:19 404

原创 利用Observable、Observer实现观察者模式

import java.util.Observable;import java.util.Observer;public class Observe { public static void mian(String args[]) { int a=10; BeingWatched watched=new BeingWatched(); Watcher1 watcher1=n

2014-05-21 16:05:32 376

原创 界面菜单栏设计

import javax.swing.*;import java.awt.*;import java.awt.event.*;public class DemoDesign { private static JFrame frame; public static void main(String args[]) { frame=new JFrame("DemoDesign");

2014-05-21 14:47:11 714

原创 swing包实现界面设计

import javax.swing.*;import java.awt.*;import java.awt.event.*;public class SwingTest{ private static JFrame frame; public static void main(String[] args) { frame=new JFrame("new JFrame");

2014-05-20 19:32:08 413

原创 界面设计添加监听器

import java.awt.*;import java.awt.event.*;public class TwoListen implements MouseListener,MouseMotionListener{ private Frame frame; private TextField textField; public void method() { frame=n

2014-05-15 10:51:05 408

原创 布局管理器BorderLayout、FlowLayout、GridLayout

import java.awt.*;public class LayoutDesign { private Frame frame; private Button bs,be,bw,bn,bc; public void method() { be=new Button("东"); bs=new Button("南"); bw=new Button("西"); bn=ne

2014-05-09 11:26:34 525

原创 GUI简单设计二

import java.awt.Frame;import java.awt.Button;import java.awt.*;public class ExGui{ private Frame frame; private Button button1; private Button button2; public void method() { frame=new Fram

2014-05-08 11:06:40 413

原创 GUI简单设计一

import java.awt.Color;import java.awt.Frame;import java.awt.Panel;public class FramePanel extends Frame{ public FramePanel(String str) { super(str); } public static void main(String args[])

2014-05-08 11:05:35 482

原创 当调用方法时出现多个异常类时,对应的两种处理方案

public class MyException extends Exception{ public MyException() { super(); } public MyException(String message) { super(message); }}public class NewException extends Exception{ publ

2014-05-06 15:24:04 805

原创 自定义异常的两种处理方式实现

public class NewExceptionTest{ public void method(String str)throws NewException { if(str==null) throw new NewException("传入的字符串不能为空"); else System.out.println(str); } //public static vo

2014-05-06 10:58:27 1225

原创 异常处理的两种方法

public class ExceptionTest{ public void method()throws Exception { System.out.println("deal with the exception"); throw new Exception(); } public static void main(String args[])throws Excepti

2014-05-05 16:09:32 446

原创 RetentionPolicy用于修饰注解能否被JVM所读取

import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Retention;@Retention(RetentionPolicy.RUNTIME)public @interface MyAnnotation{ String hello() default "mylove"; String world

2014-05-04 10:55:35 344

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除