跨域问题的前后端解决方案
摘要:什么是跨域? 假设有这么一个场景,我有一个网站,在里面有一个显示商品的功能,对应的页面地址是: http://www.myexample.com/page/page-a.html 在实现这个页面时,我通过iframe集成了另外一个网站的商品展示功能,对应的页面地址是: http://www.othe
阅读全文
posted @
2021-01-22 13:59
云淡风轻博客
阅读(1112)
推荐(0)
在java中,怎样把一个double数转换为字符串时,不用科学计数法表示。
摘要:解决方法1: 对Double类型的数字进行 格式化输出 ,相对来说不是很精确 import java.text.DecimalFormat; public class TestDouble_String { public static void main(String[] args) { Doubl
阅读全文
posted @
2021-01-19 13:57
云淡风轻博客
阅读(1136)
推荐(0)
Java并发编程:Callable、Future和FutureTask
摘要:一、Callable 与 Runnable 先说一下java.lang.Runnable吧,它是一个接口,在它里面只声明了一个run()方法: public interface Runnable { public abstract void run(); } 由于run()方法返回值为void类型,
阅读全文
posted @
2021-01-17 22:41
云淡风轻博客
阅读(134)
推荐(0)
为什么不直接去Arraylist list = new Arraylist();而是直接通过List list = new ArrayList();使用接口的好处
摘要:ArrayList不是继承List接口,是实现了List接口。 你写成ArrayList arrayList = new ArrayList();这样不会有任何问题。和List list = new ArrayList();相比这2个写是有区别的。arrayList是一个ArrayList对象,它可
阅读全文
posted @
2021-01-13 09:45
云淡风轻博客
阅读(376)
推荐(0)
Integer.valueOf()和Integer.parseInt()区别
摘要:他们返回类型的不同是最大的原因。 static int parseInt(String s) 将字符串参数作为有符号的十进制整数进行分析。 static Integer valueOf(int i) 返回一个表示指定的 int 值的 Integer 实例。 static Integer valueO
阅读全文
posted @
2021-01-12 16:52
云淡风轻博客
阅读(358)
推荐(0)
HttpClient用法--这一篇全了解(内含例子)
摘要:HttpClient相比传统JDK自带的URLConnection,增加了易用性和灵活性,它不仅使客户端发送Http请求变得容易,而且也方便开发人员测试接口(基于Http协议的),提高了开发的效率,也方便提高代码的健壮性。因此熟练掌握HttpClient是很重要的必修内容,掌握HttpClient后
阅读全文
posted @
2021-01-12 15:28
云淡风轻博客
阅读(16955)
推荐(0)
Boolean.valueOf("true")的用法
摘要:Boolean.valueOf(a);a为true时返回true不管大小写,a为其他值时都返回false;
阅读全文
posted @
2021-01-12 15:25
云淡风轻博客
阅读(349)
推荐(0)
java保留两位小数4种方法
摘要:方法一:String的format方法(推荐) double f = 111231.5585; System.out.println(String.format("%.2f", f)); 方法二:DecimalFormat的format方法 double f = 111231.5585; Decim
阅读全文
posted @
2021-01-12 10:11
云淡风轻博客
阅读(3745)
推荐(0)
为什么建议使用你 LocalDateTime ,而不是 Date?
摘要:在项目开发过程中经常遇到时间处理,但是你真的用对了吗,理解阿里巴巴开发手册中禁用static修饰SimpleDateFormat吗 通过阅读本篇文章你将了解到: 为什么需要LocalDate、LocalTime、LocalDateTime【java8新提供的类】 java8新的时间API的使用方式,
阅读全文
posted @
2020-12-28 15:33
云淡风轻博客
阅读(246)
推荐(0)
Java踩坑之List的removeAll方法
摘要:最近在公司写东西,发现List的removeAll方法报错 Demo代码如下: List<Long> ids1 = Arrays.asList(1L, 3L, 2L); List<Long> ids2 = Collections.singletonList(2L); List<Long> ids3
阅读全文
posted @
2020-12-23 11:25
云淡风轻博客
阅读(8222)
推荐(0)