11 2015 档案
摘要:一、什么是线程安全 当多个线程访问一个类时,如果不用考虑这些线程在运行时环境下的调度和交替执行,并且不需要额外的同步及在调用代码代码不必作其他的协调,这个类的行为仍然是正确的,那么称这个类是线程安全的。 内部锁 Java提供了强制性的内置锁机制:synchronized块。一个synchron...
阅读全文
摘要:一、概述 本文将讨论Java static关键字的使用。它可以被用于类名、变量、方法和块。二、静态类 只有当一个类为嵌套类时才能使用static,这个嵌套类可以不使用外部类的对象就可以访问。例子:public class TestMain { static class X { ...
阅读全文
摘要:题目链接:https://leetcode.com/problems/longest-palindromic-substring/题目:Given a stringS, find the longest palindromic substring inS. You may assume that t...
阅读全文
摘要:题目链接:https://leetcode.com/problems/median-of-two-sorted-arrays/题目:There are two sorted arraysnums1andnums2of size m and n respectively. Find the media...
阅读全文
摘要:一、概述 Android系统为实现通信将PC电脑IP设置为10.0.2.2,自身设置为127.0.0.1,而PC并没有为Android模拟器系统指定IP,所以PC电脑不能通过IP来直接访问Android模拟器,要实现PC机和Android模拟器之间的相互通信必须借助于端口重定向(redir)。二、...
阅读全文
摘要:题目链接:https://leetcode.com/problems/longest-substring-without-repeating-characters/题目:Given a string, find the length of the longest substring without ...
阅读全文