Java将SQL转换成java代码

public static void main(String[] args) throws IOException {
        System.err.println("请输入SQL:");
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        ArrayList<String> list = new ArrayList<>();
        list.add("StringBuilder sql = new StringBuilder();");
        String next = bf.readLine();
        while (true) {
            if (next.length() == 0) {
                break;
            }
            list.add("sql.append(\" " + next + " \");");
            next = bf.readLine();
        }
        for (String sql : list) {
            System.out.println(sql);
        }
    }

你可能感兴趣的:(Java基础,java输入)