Java面试题(1)

Java 面试题(1) 创建不可修改的对象 不提供setter方法 实例变量声明private final final class 修饰类,防止继承 方法返回时,final修饰的实例变量可以直接返回,否则返回copy。 不可变对象的优点 方便创建、使用和测试。 线程安全的(String) 适合作为Map和Set的Key。 允许hashcode延迟初始化和缓存 example 123...

阅读全文

HashMap原理

HashMap 工作原理 概念 hash算法,将任何变量或对象,计算一个唯一的值。 map, 将对象通过key,映射到值。examplehashmap使用内部类:Entry存数据。12345678static class Entry<K, V> implements Map.Entry<K,V>{final K key;V value;Entry<K,...

阅读全文

黑客与画家书摘

黑客与画家 保罗.格雷厄 创业公式 搭建原型 上线运营(别管bug) 收集反馈 调整产品 成长壮大 Cool Hack 好玩 高智商 探索精神 黑客理论(hacker ethic) 使用计算机以及所有有助于了解这个世界本质的事物都不应受到任何限制。任何事情都应该亲手尝试。(Access to computers-and anything that might teach yo...

阅读全文

Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick StartCreate a new post1$ hexo new "My New Post" More info: Writing Run server1$ hexo server More info: Server Generate static files1$ hexo generat...

阅读全文

MongoDB in practice

#MongoDB in Priactice 1. install安装路径 G:\Tools\MongoDB 2. onfig新建mongodb.config放到G:\Tools\MongoDB\bin内容 12345## 数据库文件目录 dbpath=G:/Tools/MongoDB/data ## 日志目录 logpath=G:/Tools/MongoDB/log/mongo.log d...

阅读全文

数据结构基础

原文地址:github.com/kdn251/interviews 译文出自:掘金翻译计划 译者:王下邀月熊 校对者:PhxNirvana、根号三 这个 链接 用来查看本翻译与英文版是否有差别(如果你没有看到 README.md 发生变化,那就意味着这份翻译文档是最新的)。 Interviews 软件工程技术面试个人指南。 Maintainer - Kevin Naughton Jr...

阅读全文

Java Bit 操作优化算法

Java Bit 操作优化算法 基本操作符 & 或 | 与 ^ 异或 ! 非 << 左移 >> 右移 >>> 无符号右移 Examples 统计1的bit个数1234567int count_one(int n) { while(n) { n = n&(n-1); count++; } return count;} 判断是否4的N次方1234bool isPowerOfFour(int n) { return !(n&(n-1)) && (n&0x55555555); //check t...

阅读全文

© 2017 Hello World All Rights Reserved. 本站访客数人次 本站总访问量
Theme by hiero