Java程序设计

Java访问权限:https://www.cnblogs.com/starhu/p/5143983.html

Class:public&default

变量&方法:public&protected&default&private

StringBuffer 使用: https://blog.csdn.net/qq_40817827/article/details/89313998

Map用法:https://blog.csdn.net/qq_29373285/article/details/81487594

Java泛型:https://www.cnblogs.com/coprince/p/8603492.html

Java命令行参数(用IDEA):https://blog.csdn.net/qq_34453300/article/details/86769834

Java文件目录相关:

  获取当前程序文件目录:https://blog.csdn.net/AsuKA_F/article/details/94488884

  获得文件信息(大小,修改时间):https://blog.csdn.net/qq_42446456/article/details/88357840

  关于File.seperator : https://www.cnblogs.com/xlizi/p/9303217.html

  列出Directory的文件信息,并递归下一层:https://blog.csdn.net/ikv1989/article/details/79743209

  关于打开目录查看文件信息的代码(递归目录树):

Usage:

java DirListing [-R] [-verbose] [directory]
import java.text.SimpleDateFormat;
import java.util.*;
import java.io.*;
class WrongFormatException extends Exception{
    public String toString(){
        return "Wrong Input Format";
    }
}
public class DirListing {
    static void printFile(File s,int type,int dep){
        for(int i=0;i<dep;++i){
            System.out.printf(" ");
        }
        if(s.isDirectory()){
            System.out.println(s);
            File[] result=s.listFiles();
            if(result!=null){
                for(int x=0;x<result.length;++x){
                    printFile(result[x],type,dep+2);
                }
            }
        }else{
            System.out.print(s);
            if(type==1){
                System.out.printf(" "+s.length()+"KB ");
                Date date=new Date(s.lastModified());
                SimpleDateFormat sd=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
                System.out.printf(sd.format(date));
            }
            System.out.println("");
        }
    }
    public static void main(String[] args) throws WrongFormatException{
        int type=0;
        if(!args[0].equals("[-R]")) throw new WrongFormatException();

        if(args[1].equals("[-verbose]")) type=1;
        else if(args[1].equals("[non-verbose]")) type=0;
        else {
            throw new WrongFormatException();
        }
        File f0=new File("");
        File f1=new File(f0.getAbsolutePath());
        if (args.length == 3) {
            f1=new File(args[3]);
        }

        if(f1.isDirectory()&&f1.exists()){
            printFile(f1,type,0);
        }else throw new WrongFormatException();
    }
}
View Code

 

Java序列化的操作:(好东西!相当于利用stream直接把class放到文件里面!根本不用考虑class的输出格式!)

https://baijiahao.baidu.com/s?id=1633305649182361563&wfr=spider&for=pc

 

JavaFX相关:

对话框Dialog:https://blog.csdn.net/qq_40990854/article/details/85161449

选择框ChoiceBox:https://blog.csdn.net/final0402/article/details/86666446   https://blog.csdn.net/moakun/article/details/83047267

关于弹窗:https://blog.csdn.net/h390291060/article/details/83412784

菜单menubar相关:https://blog.csdn.net/hujyhfwfh2/article/details/89278003

一些细节:

Button[] 开数组的话,需要开始new一次,每一个Button也要new 一次。。。

AnchorPane好用。

GridPane先列后行

 

Java 的thread:

可以用thread的setName来设定thread的名字,然后相应的Runnable的run函数中,可以输出当前占用这个Runnable的线程的名字

https://blog.csdn.net/Soinice/article/details/84504371

posted @ 2021-10-08 21:51  *Miracle*  阅读(154)  评论(0编辑  收藏  举报