下面我们再给出一个线程不安全的例子。 例:1.8.2 class BookMark_to_win { int bookNum=10; void onlySellOne() { if (bookNum > 0) { System.out.println(Thread.currentThread().g ...
分类:
编程语言 时间:
2021-04-23 12:23:20
阅读次数:
0
笔试算法题中,有时候是要自己处理输入,比如从键盘中接收一个数,整理了一些常用的,真正笔试之前可以看一看。 输入 循环输入: Scanner sc = new Scanner(System.in); while (sc.hasNextLine()){ String s = sc.nextLine(); ...
分类:
编程语言 时间:
2021-04-23 12:06:51
阅读次数:
0
如题,直接序列化会报错, 好像百度不到, 自已看了半个小时的官方文档, 摸索出来了, 需要 实现一个 IMessagePackFormatter<Color> 接口, 代码如下: 1 using MessagePack; 2 using MessagePack.Formatters; 3 using ...
开发工具:Android Studio TestView(线性布局) 1、基本属性: layout_width:组件宽度(单位dp) layout_height:组件高度 id:组件id text:文本内容 textColor:字体颜色 textStyle:字体风格,normal(无效果)、bold ...
分类:
移动开发 时间:
2021-04-22 16:12:15
阅读次数:
0
二进制水题~。 int n,m; int main() { cin>>n>>m; while(m--) { string s; cin>>s; int res=0; for(int i=0;i<s.size();i++) if(s[i] == 'n') res+=1<<(n-1-i); cout<< ...
分类:
其他好文 时间:
2021-04-22 15:39:34
阅读次数:
0
<br>换行标记(单独的Enter在HTML只会被当作一个特殊字符,不属于换行符) <P>段落标记 如:<P>第二段</P> 标题标记:分1-6级标题,其中<h1>为1级标题,<h2>为2级标题,以此类推到<6> 标题标记格式:<h1>标题1</h1> 居中标记:<center><h1>标题1</h ...
分类:
Web程序 时间:
2021-04-22 15:20:34
阅读次数:
0
何谓方法? System.out.println(),那么它是什么呢? System是一个类,out是一个对象,println()就是一个方法,这句话的理解就是,调用System类里的一个out对象中的方法叫做println Java方法是语句的集合,它们在一起执行一个功能。(如果需要用到大量的a+ ...
分类:
编程语言 时间:
2021-04-22 15:16:19
阅读次数:
0
在/root/init.rc中添加下面内容, 开机就会执行/system/bin/boot-complete-script.sh脚本 service boot_complete_script /system/bin/boot-complete-script.sh class main oneshot ...
分类:
移动开发 时间:
2021-04-21 12:38:11
阅读次数:
0
堆排序 public class HeapSort { public static void main(String[] args) { int[] arr = {1, 3, 519, 2, 10, 8, 0, 998}; heapSort(arr); System.out.println(Arra ...
分类:
编程语言 时间:
2021-04-21 12:26:45
阅读次数:
0
今天在.Netcore项目里增加了图片验证码功能,在windows部署下未发现问题,但是在Linux(Centos)下部署却出现了如下问题 查了下是因为用了System.Drawing.Common类库需要在linux下安装一下libgdiplus来支持图像处理,图片处理,因为我的环境是在Docke ...
分类:
Web程序 时间:
2021-04-21 12:05:44
阅读次数:
0