public int calculate(String s) { int len = s.length(); Stack<Integer> s1 = new Stack<>(); // 操作数栈 int num = 0; char preSign = '+'; // 为了方便计算,1+1+1 > + ...
分类:
其他好文 时间:
2021-07-07 17:55:15
阅读次数:
0
准备工作 public class MainClass { public static void main(String[] args) throws Exception { String resources = "mybatis-config.xml"; InputStream inputStre ...
分类:
其他好文 时间:
2021-07-07 17:50:47
阅读次数:
0
二维数组的遍历使用foreach public int numWays(int n, int[][] relation, int k) { ways = 0; this.n = n; this.k = k; edges = new ArrayList<>(); //把关系处理成list,类似于图的每 ...
分类:
编程语言 时间:
2021-07-07 17:49:25
阅读次数:
0
@PostMapping("uploads") public String posts(@RequestParam("file") List<MultipartFile> files){//参数file以list数组接收 if (files.isEmpty()) { return "上传失败,请选择 ...
分类:
Web程序 时间:
2021-07-06 16:22:43
阅读次数:
0
defer是延迟执行。如果存在多个defer,运行顺序是先进后出,属于堆栈结构 f, err := os.Create(fileName) if err != nil { fmt.Println("Create file failed:", err) return nil, err } defer ...
分类:
编程语言 时间:
2021-07-05 19:08:05
阅读次数:
0
morphologyEx void Demo_1(int, void*) { cvtColor(img1, img_gray1, COLOR_BGR2GRAY); //二值化 threshold(img_gray1, img2, 0, 255, THRESH_BINARY | THRESH_OTSU ...
分类:
其他好文 时间:
2021-07-05 18:58:25
阅读次数:
0
使用lambda表达式 Collections.sort(List, (a,b) -> x1 - x2); 自定义Comparator方法 Collections.sort(List, new Comparator<E>(){ public int compare(int a, int b){ re ...
分类:
编程语言 时间:
2021-07-05 18:56:31
阅读次数:
0
接口定义 interface 关键字定义的类就叫接口 接口实例 <?php //接口定义 interface Human{ //跑步 public function run(); //跳远 public function jump(); } //接口实现 class Person implement ...
分类:
Web程序 时间:
2021-07-05 18:53:37
阅读次数:
0
获取类路径下文件的绝对路径 在IDEA软件中,src是类的根路径。 package com.happy.reflection; public class AboutPath { public static void main(String[] args) { String path = Thread ...
分类:
其他好文 时间:
2021-07-05 18:39:57
阅读次数:
0
模拟多个线程同时买票 package com.JUC; //基本买票 /* 线程就是一个单独的资源类,没有任何附属操作 * */ public class SynchronizedDemo1 { public static void main(String[] args) { Ticket tick ...
分类:
其他好文 时间:
2021-07-05 18:23:51
阅读次数:
0