Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
342ea67
Create why-is-printing-b-dramatically-slower-than-printing.md
zhongjianluxian Apr 4, 2016
e0961b7
Merge pull request #1 from zhongjianluxian/why-is-printing-b-dramatic…
zhongjianluxian Apr 4, 2016
92e3f02
remove unnecessary spaces
zhongjianluxian Apr 4, 2016
8ca6028
Merge pull request #2 from zhongjianluxian/why-is-printing-b-dramatic…
zhongjianluxian Apr 4, 2016
dd3587c
Update why-is-printing-b-dramatically-slower-than-printing.md
zhongjianluxian Apr 5, 2016
ae67302
Merge pull request #3 from zhongjianluxian/why-is-printing-b-dramatic…
zhongjianluxian Apr 5, 2016
463f633
Create how-can-i-pad-an-integers-with-zeros-on-the-left.md
zhongjianluxian Apr 5, 2016
79a74a6
java的vector类为什么被认为过时了
jssyjam Apr 17, 2016
9f94d69
Update why-is-java-vector-class-considered-obsolete-or-deprecated.md
jssyjam Apr 17, 2016
951f880
fanyi
jssyjam Apr 17, 2016
95d58f5
xiugai
jssyjam Apr 17, 2016
c223730
Create onvert-a-string-to-an-enum-in-java.md
tangculijier May 3, 2016
5d872de
Create how-does-the-java-for-each-loop-work.md
alexduan-mel May 9, 2016
eae0527
Update what-is-a-serialversionuid-and-why-should-i-use-it.md
KingAlen May 18, 2016
413b445
tianjiafanyi
May 19, 2016
f82979f
Update what-issues-should-be-considered-when-overriding-equals-and-ha…
NothingOne May 19, 2016
c59b831
Merge pull request #40 from zhongjianluxian/master
giantray May 23, 2016
e4c99d7
更新已翻译问题
giantray May 23, 2016
b49f2a4
Merge branch 'master' of https://github.com/jssyjam/stackoverflow-jav…
giantray May 23, 2016
2012c1d
Merge branch 'jssyjam-master'
giantray May 23, 2016
6173090
更新未翻译问题
giantray May 23, 2016
ee5bfae
no message
giantray May 23, 2016
d4c89a5
Merge pull request #47 from wjk20120522/patch-1
giantray May 24, 2016
f092ace
Merge pull request #50 from NothingOne/patch-1
giantray May 24, 2016
016ec72
Merge pull request #46 from ArronDon/master
giantray May 24, 2016
36e774a
Merge pull request #44 from tangculijier/master
giantray May 24, 2016
7ab16f3
更新已翻译问题
giantray May 25, 2016
f0bc018
Merge branch 'master' of https://github.com/YuxiangQue/stackoverflow-…
giantray May 25, 2016
a4adac5
更新已翻译问题
giantray May 25, 2016
c4ef2b4
Why is subtracting these two times (in 1927) giving a strange result?
severalfly May 27, 2016
3a6e5f3
Merge pull request #51 from severalfly/master
giantray May 28, 2016
4164f04
代码排版、修改错别字
Yixiaohan May 31, 2016
6c3adf5
Merge pull request #52 from Yixiaohan/patch-3
giantray Jun 1, 2016
4b61f49
修改提交空文件的问题
Jun 1, 2016
3711480
Merge pull request #1 from giantray/master
alexduan-mel Jun 1, 2016
94d6991
when-and-how-should-i-use-a-threadlocal-variable
alexduan-mel Jun 1, 2016
36c07fc
Update when-and-how-should-i-use-a-threadlocal-variable.md
alexduan-mel Jun 1, 2016
500ee1d
翻译Convert a String to an enum in Java
DaiDongLiang Jun 30, 2016
cc2ca4a
Create why-is-subtracting-these-two-times-in-1927-giving-a-strange-re…
gaoshihang Jul 25, 2016
bbe5225
Update why-is-subtracting-these-two-times-in-1927-giving-a-strange-re…
gaoshihang Jul 25, 2016
a914c65
owen1190
owen1190 Aug 2, 2016
7c7b598
更新已翻译问题
giantray Aug 2, 2016
8101202
Merge pull request #49 from zouzls/master
giantray Aug 2, 2016
cbc23f1
Merge pull request #53 from ArronDon/master
giantray Aug 2, 2016
1192526
Merge pull request #54 from DaiDongLiang/master
giantray Aug 2, 2016
0c8be56
更新已翻译问题
giantray Aug 2, 2016
dd26ebd
Merge branch 'master' of https://github.com/andysim3d/stackoverflow-j…
giantray Aug 2, 2016
9eafdcb
更新已翻译问题
giantray Aug 2, 2016
df120f9
Merge pull request #57 from gaoshihang/patch-2
giantray Aug 2, 2016
b609912
更新已翻译问题
giantray Aug 2, 2016
2d7c9a0
添加gitbook
giantray Aug 3, 2016
561f48d
owen1190 8/3
owen1190 Aug 3, 2016
465351b
translate how-do-i-create-a-java-string-from-the-contents-of-a-file
andysim3d Aug 4, 2016
b11f01e
Update how-do-i-create-a-java-string-from-the-contents-of-a-file.md
andysim3d Aug 4, 2016
1eeda60
Update how-do-i-create-a-java-string-from-the-contents-of-a-file.md
andysim3d Aug 4, 2016
e719fac
what-is-the-difference-between-a-soft-reference-and-a-weak-reference-…
owen1190 Aug 5, 2016
dfc8923
what-is-the-difference-between-a-soft-reference-and-a-weak-reference-…
owen1190 Aug 5, 2016
cbbb387
what-is-the-difference-between-jsf-servlet-and-jsp finished
Aug 9, 2016
14b2cc9
Merge pull request #61 from owen1190/master
giantray Aug 17, 2016
984c94b
更新已翻译问题
giantray Aug 17, 2016
38708d6
Merge pull request #63 from andysim3d/translate_create_string_from_file
giantray Aug 17, 2016
0edbc18
更新已翻译问题
giantray Aug 17, 2016
b940fe1
Merge pull request #64 from owen1190/master
giantray Aug 17, 2016
155499c
Merge pull request #65 from ccrfrog/master
giantray Aug 17, 2016
679cce1
更新已翻译问题
giantray Aug 17, 2016
1d7bcfa
更新吐槽方式
giantray Aug 17, 2016
8cc8fe4
ADD: java-inner-class-and-static-nested-class.md
troyliu0105 Aug 17, 2016
63083bf
owen1190
owen1190 Aug 17, 2016
9e9aa6e
add->whats-the-difference-between-component-repository-service-annota…
AcceptedBoy Aug 17, 2016
1b93836
Merge pull request #67 from troyliu0105/master
giantray Aug 17, 2016
13fd9c6
更新已翻译问题
giantray Aug 17, 2016
c5fb142
Merge pull request #68 from owen1190/master
giantray Aug 17, 2016
60e629a
Merge pull request #70 from AcceptedBoy/master
giantray Aug 17, 2016
8fffae4
更新已翻译问题
giantray Aug 17, 2016
8561923
add->iterating-through-a-collection-avoiding-concurrentmodificationex…
AcceptedBoy Aug 17, 2016
174194e
Merge pull request #72 from AcceptedBoy/master
giantray Aug 18, 2016
5ebf821
更新已翻译问题
giantray Aug 18, 2016
6280541
add->how-do-you-assert-that-a-certain-exception-is-thrown-in-junit-4-…
AcceptedBoy Aug 18, 2016
01ca924
update->junit4 && add->create_generic_array
AcceptedBoy Aug 18, 2016
6aaae68
add_stackoverflow_address->create_generic_array
AcceptedBoy Aug 18, 2016
86bf225
add->how-can-i-create-an-executable-jar-with-dependencies-using-maven.md
AcceptedBoy Aug 18, 2016
4631058
add->intellij && update->difference of spring annotation
AcceptedBoy Aug 18, 2016
1bac5e9
android-sdk-installation-doesnt-find-jdk
Aug 22, 2016
ac2cf11
Merge pull request #73 from AcceptedBoy/master
giantray Aug 22, 2016
bca7ea7
更新已翻译问题
giantray Aug 22, 2016
463b264
Merge pull request #75 from NoahZu/master
giantray Aug 22, 2016
f54a51d
更新已翻译问题
giantray Aug 22, 2016
ca5550b
更新已翻译问题
giantray Aug 24, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 32 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@

stackoverflow-Java-top-qa
=======================
对stackoverflow上Java相关、投票数TOP100的问答进行翻译,欢迎点star,我们会持续更新!!!

为了让“翻译”更有意义,给阅读者带来更多、更有效的收获,我们会有一些加工:
例如,对问题进行分类,整合多个答案、删除冗余内容、加上自己的验证结果、心得等等

对于参与翻译的人,这也是很好的一个学习、理解过程,欢迎大家一起来翻译

-------------
### 如何参与翻译(欢迎加入翻译组QQ群485011036)
如何参与:
- 请从下文“待翻译问题链接”中寻找你感兴趣的问答进行翻译。翻译好的问答,放到contents目录下,无需更新readme.md文档。之后提一个PR,我会对你的翻译做一个审校,并更新到readme中
####如何参与:
- 请从下文“待翻译问题链接”中寻找你感兴趣的问答进行翻译。翻译好的问答,放到contents目录下,无需更新readme.md文档。之后提一个PR,我负责合并PR并更新到readme中
- 另外,为了避免多人重复新翻译一个问题,你可以提issue,说明你计划翻译的问题及时间点,我可以先更新到下面的”未翻译问题“中,说明已有人领了这个问题。当然,也不一定要提issue,一般情况下,只要及时提pr,我及时审核,出现”撞车“的概率并不高。

一些基本的约定:
####一些基本的约定:
- 文档的文件名,和stackoverflowhich-notnull-java-annotation-should-i-usew上的url保持一致。例如,http://stackoverflow.com/questions/8710619/java-operator 的文件名, 就是java-operator.md
- 在每篇翻译文档内容的最后,要附上stackoverflow的原文链接

每个人可以做(但不限于):
####每个人可以做(但不限于):
- 找未翻译的问题进行翻译
- 优化已翻译的问题
- 输出问答精简汇总版(把所有的问答集中到一个md文件,然后尽量精简,让别人可以在一天内把这100个问题的精髓都看完)
- 输出gitbook版本(现在直接在github上查看,体验不好)

####文档优化反馈:
请大家多多反馈,优化已翻译好的文章:可以到[吐槽区](https://github.com/giantray/stackoverflow-java-top-qa/issues/66)吐槽,也可以在已翻译文章基础上进行优化,提新的PR。文章质量的提升,需要大家一起努力!


### 目录
> 基础语法

Expand Down Expand Up @@ -53,6 +58,18 @@ stackoverflow-Java-top-qa
* [比较java枚举成员使用equal还是==](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/comparing-java-enum-members-or-equals.md)
* [用java怎么创建一个文件并向该文件写文本内容](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/how-to-create-a-file-and-write-to-a-file-in-java.md)
* [serialVersionUID 有什么作用?该如何使用?](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/what-is-a-serialversionuid-and-why-should-i-use-it.md)
* [为什么Java的```Vector```类被认为是过时的或者废弃的](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/why-is-java-vector-class-considered-obsolete-or-deprecated.md)
* [Java的foreach循环是如何工作的](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/how-does-the-java-for-each-loop-work.md)
* [为什么相减这两个时间(1927年)会得到奇怪的结果](/contents/why-is-subtracting-these-two-times-in-1927-giving-a-strange-result.md)
* [Java 中如何将 String 转换为 enum](/contents/lookup-enum-by-string-value.md)
* [该什么时候使用 ThreadLocal变量,它是如何工作的](/contents/when-and-how-should-i-use-a-threadlocal-variable.md)
* [servlets的运行原理](/contents/how-do-servlets-work-instantiation-shared-variables-and-multithreading.md)
* [如何计算MD5值](/contents/how-can-i-generate-an-md5-hash.md)
* [Java中软引用和弱引用的区别](/contents/what-is-the-difference-between-a-soft-reference-and-a-weak-reference-in-java.md)
* [JSF, Servlet 和 JSP (三种技术)有什么区别](/contents/what-is-the-difference-between-jsf-servlet-and-jsp.md)
* [Java内部类和嵌套静态类](/contents/java-inner-class-and-static-nested-class.md)
* [@Component, @Repository, @Service的区别](/contents/whats-the-difference-between-component-repository-service-annotations-in.md)
* [如何创建泛型java数组](/contents/how-to-create-a-generic-array-in-java.md)

> 编程技巧

Expand All @@ -72,7 +89,12 @@ stackoverflow-Java-top-qa
* [我应该用哪一个@NotNull注解](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/which-notnull-java-annotation-should-i-use.md)
* [怎样将堆栈追踪信息转换为字符串](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/how-can-i-convert-a-stack-trace-to-a-string.md)
* [如何处理 java.lang.outOfMemoryError PermGen space error](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/dealing-with-java-lang-outofmemoryerror-permgen-space-error.md)

* [如何在整数左填充0](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/how-can-i-pad-an-integers-with-zeros-on-the-left.md)
* [在调用 instanceof 前需要进行null检查吗](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/is-null-check-needed-before-calling-instanceof.md)
* [如何从文件里读取字符串](/contents/how-do-i-create-a-java-string-from-the-contents-of-a-file.md)
* [遍历集合时移除元素,怎样避免ConcurrentModificationException异常抛出](/contents/iterating-through-a-collection-avoiding-concurrentmodificationexception-when-reiterating-through-a-collection-avoiding-concurrentmodificationexception-when-re.md)
* [如何让IntelliJ编辑器永久性显示代码行数](/contents/how-can-i-permanently-have-line-numbers-in-intellij.md)
* [如何使用maven把项目及其依赖打包为可运行jar包](/contents/how-can-i-create-an-executable-jar-with-dependencies-using-maven.md)

> 网络

Expand All @@ -83,64 +105,46 @@ stackoverflow-Java-top-qa
* [LinkedList、ArrayList各自的使用场景,如何确认应该用哪一个呢?](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/when-to-use-linkedlist-over-arraylist.md)
* [StringBuilder和StringBuffer有哪些区别呢](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/stringbuilder-and-stringbuffer.md)
* [为什么处理排序的数组要比非排序的快](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/why-is-processing-a-sorted-array-faster-than-an-unsorted-array.md)
* [如何使用Java创建一个内存泄漏的程序](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/creating-a-memory-leak-with-java.md)
* [为什么打印“B”会明显的比打印“#”慢](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/why-is-printing-b-dramatically-slower-than-printing.md)

> 测试

* [如何测试 private 方法,变量或者内部类](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/how-to-test-a-class-that-has-private-methods-fields-or-inner-classes.md)
* [JUnit4如何断言确定异常的抛出](/contents/how-do-you-assert-that-a-certain-exception-is-thrown-in-junit-4-tests.md)

> Android

* [在Android里面下载文件,并在ProgressDialog显示进度](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/download-a-file-with-android-and-showing-the-progress-in-a-progressdialog.md)
* [如何获取Android设备唯一ID](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/is-there-a-unique-android-device-id.md)
* [安装Android SDK的时候找不到JDK](contents/android-sdk-installation-doesnt-find-jdk.md)

### 待翻译问题链接(还剩x问题)
- [Why is subtracting these two times (in 1927) giving a strange result?](http://stackoverflow.com/questions/6841333/why-is-subtracting-these-two-times-in-1927-giving-a-strange-result)
- [Proper use cases for Android UserManager.isUserAGoat()?](http://stackoverflow.com/questions/13375357/proper-use-cases-for-android-usermanager-isuseragoat)
- [Creating a memory leak with Java [closed]](http://stackoverflow.com/questions/6470651/creating-a-memory-leak-with-java) 用户AutumnLight正在翻译该问题
- [Why is printing “B” dramatically slower than printing “#”?](http://stackoverflow.com/questions/21947452/why-is-printing-b-dramatically-slower-than-printing)
- [How can I create an executable jar with dependencies using Maven?](http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven)
- [Why is executing Java code in comments with certain Unicode characters allowed?](http://stackoverflow.com/questions/30727515/why-is-executing-java-code-in-comments-with-certain-unicode-characters-allowed)
- [Convert a String to an enum in Java](http://stackoverflow.com/questions/604424/convert-a-string-to-an-enum-in-java)
- [Android SDK installation doesn't find JDK](http://stackoverflow.com/questions/4382178/android-sdk-installation-doesnt-find-jdk)
- [Java inner class and static nested class](http://stackoverflow.com/questions/70324/java-inner-class-and-static-nested-class)
- ['Must Override a Superclass Method' Errors after importing a project into Eclipse](http://stackoverflow.com/questions/1678122/must-override-a-superclass-method-errors-after-importing-a-project-into-eclips)
- [Fastest way to determine if an integer's square root is an integer](http://stackoverflow.com/questions/295579/fastest-way-to-determine-if-an-integers-square-root-is-an-integer)
- [How to fix: Unsupported major.minor version 51.0 error?](http://stackoverflow.com/questions/10382929/how-to-fix-unsupported-major-minor-version-51-0-error)
- [How to generate a random alpha-numeric string?](http://stackoverflow.com/questions/41107/how-to-generate-a-random-alpha-numeric-string)
- [Comparing Java enum members: == or equals()?](http://stackoverflow.com/questions/1750435/comparing-java-enum-members-or-equals)
- [Failed to load the JNI shared Library (JDK)](http://stackoverflow.com/questions/7352493/failed-to-load-the-jni-shared-library-jdk)
- [How to create a Java String from the contents of a file?](http://stackoverflow.com/questions/326390/how-to-create-a-java-string-from-the-contents-of-a-file)
- [How do you assert that a certain exception is thrown in JUnit 4 tests?](http://stackoverflow.com/questions/156503/how-do-you-assert-that-a-certain-exception-is-thrown-in-junit-4-tests)
- [What exactly is Apache Camel?](http://stackoverflow.com/questions/8845186/what-exactly-is-apache-camel)
- [How can I permanently have line numbers in IntelliJ?](http://stackoverflow.com/questions/13751/how-can-i-permanently-have-line-numbers-in-intellij)
- [How do servlets work? Instantiation, shared variables and multithreading](http://stackoverflow.com/questions/3106452/how-do-servlets-work-instantiation-shared-variables-and-multithreading)
- [Access restriction on class due to restriction on required library rt.jar?](http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar)
- [How do I discover memory usage of my application in Android?](http://stackoverflow.com/questions/2298208/how-do-i-discover-memory-usage-of-my-application-in-android)
- [How can I generate an MD5 hash?](http://stackoverflow.com/questions/415953/how-can-i-generate-an-md5-hash)
- [Uncatchable ChuckNorrisException](http://stackoverflow.com/questions/13883166/uncatchable-chucknorrisexception)
- [Can I add jars to maven 2 build classpath without installing them?](http://stackoverflow.com/questions/364114/can-i-add-jars-to-maven-2-build-classpath-without-installing-them)
- [Update Eclipse with Android development tools v. 23](http://stackoverflow.com/questions/24437564/update-eclipse-with-android-development-tools-v-23)
- [Setting multiple jars in java classpath](http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath)
- [Iterating through a list, avoiding ConcurrentModificationException when removing in loop](http://stackoverflow.com/questions/223918/iterating-through-a-list-avoiding-concurrentmodificationexception-when-removing)
- [Is null check needed before calling instanceof](http://stackoverflow.com/questions/2950319/is-null-check-needed-before-calling-instanceof)
- [How does the Java for each loop work?](http://stackoverflow.com/questions/85190/how-does-the-java-for-each-loop-work)
- [What is the Java equivalent for LINQ?](http://stackoverflow.com/questions/1217228/what-is-the-java-equivalent-for-linq)
- [Hibernate hbm2ddl.auto possible values and what they do?](http://stackoverflow.com/questions/438146/hibernate-hbm2ddl-auto-possible-values-and-what-they-do)
- [How to round a number to n decimal places in Java](http://stackoverflow.com/questions/153724/how-to-round-a-number-to-n-decimal-places-in-java)
- [How can I pad an integers with zeros on the left?](http://stackoverflow.com/questions/473282/how-can-i-pad-an-integers-with-zeros-on-the-left)
- [Sort ArrayList of custom Objects by property](http://stackoverflow.com/questions/2784514/sort-arraylist-of-custom-objects-by-property)
- [What's the difference between @Component, @Repository & @Service annotations in Spring?](http://stackoverflow.com/questions/6827752/whats-the-difference-between-component-repository-service-annotations-in)
- [Why is Java Vector class considered obsolete or deprecated?](http://stackoverflow.com/questions/1386275/why-is-java-vector-class-considered-obsolete-or-deprecated)
- [Efficiency of Java “Double Brace Initialization”?](http://stackoverflow.com/questions/924285/efficiency-of-java-double-brace-initialization)
- [Why does this go into an infinite loop?](http://stackoverflow.com/questions/3831341/why-does-this-go-into-an-infinite-loop)
- [When and how should I use a ThreadLocal variable?](http://stackoverflow.com/questions/817856/when-and-how-should-i-use-a-threadlocal-variable)
- [decompiling DEX into Java sourcecode](http://stackoverflow.com/questions/1249973/decompiling-dex-into-java-sourcecode)
- [How to create a generic array in Java?](http://stackoverflow.com/questions/529085/how-to-create-a-generic-array-in-java)
- [Why does Math.round(0.49999999999999994) return 1](http://stackoverflow.com/questions/9902968/why-does-math-round0-49999999999999994-return-1)
- [Eclipse: Set maximum line length for auto formatting?](http://stackoverflow.com/questions/3697287/eclipse-set-maximum-line-length-for-auto-formatting)
- [What is the difference between a soft reference and a weak reference in Java?](http://stackoverflow.com/questions/299659/what-is-the-difference-between-a-soft-reference-and-a-weak-reference-in-java)
- [What is the equivalent of the C++ Pair<L,R> in Java?](http://stackoverflow.com/questions/156275/what-is-the-equivalent-of-the-c-pairl-r-in-java)
- [What is the difference between JSF, Servlet and JSP?](http://stackoverflow.com/questions/2095397/what-is-the-difference-between-jsf-servlet-and-jsp)
- [How do I “decompile” Java class files?](http://stackoverflow.com/questions/272535/how-do-i-decompile-java-class-files)
- [Useful Eclipse Java Code Templates [closed]](http://stackoverflow.com/questions/1028858/useful-eclipse-java-code-templates)
- [How to call SOAP web service in Android](http://stackoverflow.com/questions/297586/how-to-call-soap-web-service-in-android)
Expand Down
1 change: 1 addition & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\# Summary* [前言](README.md)
33 changes: 33 additions & 0 deletions contents/android-sdk-installation-doesnt-find-jdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
##安装Android SDK的时候找不到JDK

###问题
我在我的win7 64位的系统上安装Android SDK时,jdk-6u23-windows-x64.exe已经安装上了,但是Android SDK的安装程序却因为找不到已安装的JDK无法继续下去。
这个问题出现过吗?有没有办法解决呢?

![](http://ww2.sinaimg.cn/large/0060lm7Tgw1f72ny3m6oaj30ds0a0gmi.jpg)

###回答1:
当你看到这个提示(找不到jdk)的时候按Back(返回),然后再点Next(下一步)。这个时候,它将会去寻找JDK

###回答2:
实际安装:

- 系统:windows 8.1
- JDK文件: jdk-8u11-windows-x64.exe
- ADT文件:installer_r23.0.2-windows.exe
安装64位JDK,然后尝试第一个回答中的back-next的方法。然后尝试设置JAVA_HOME 根据错误信息的提示,但是,仍旧对我没有用处,然后,尝试如下解决办法:

按照它说的做,设置JAVA_HOME在你的系统环境变量中,这个路径要使用正斜杠(/)而非反斜杠(\)

**注意:**
当我把JAVA_HOME设置为C:\Program Files\Java\jdk1.6.0_31的时候还是不行,但是当我设置成C:/Program Files/Java/jdk1.6.0_31的时候就ok了。快把我逼疯了。

如果还不行,就把 %JAVA_HOME%加在环境变量Path的头部。

下面是我的环境变量的配置:
- JAVA_HOME=C:/Program Files/Java/jdk1.8.0_11
- JRE_HOME=C:/Program Files/Java/jre8
- Path=%JAVA_HOME%;C:...

stackoverflow链接:
http://stackoverflow.com/questions/4382178/android-sdk-installation-doesnt-find-jdk
16 changes: 9 additions & 7 deletions contents/avoiding-null-statements-in-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public interface Parser {

我们来改造一下

类定义如下,这样定义findAction方法后,确保无论用户输入什么,都不会返回null对象
类定义如下,这样定义findAction方法后,确保无论用户输入什么,都不会返回null对象:
```java
public class MyParser implements Parser {
private static Action DO_NOTHING = new Action() {
public void doSomething() { /* do nothing */ }
Expand All @@ -62,7 +63,7 @@ public class MyParser implements Parser {
return DO_NOTHING;
}
}}

```

对比下面两份调用实例
1. 冗余: 每获取一个对象,就判一次空
Expand All @@ -74,7 +75,8 @@ if (parser == null) {
}
Action action = parser.findAction(someInput);
if (action == null) {
// do nothing} else {
// do nothing}
else {
action.doSomething();}
```

Expand All @@ -90,11 +92,11 @@ ParserFactory.getParser().findAction(someInput).doSomething();
- 如果要用equal方法,请用object<不可能为空>.equal(object<可能为空>))
例如:
使用
"bar".equals(foo)
`"bar".equals(foo) `
而不是
foo.equals("bar")
`foo.equals("bar") `
- Java8或者guava lib中,提供了Optional类,这是一个元素容器,通过它来封装对象,可以减少判空。不过代码量还是不少。不爽。
- 如果你想返回null,请挺下来想一想,这个地方是否更应该抛出一个异常
- 如果你想返回null,请停下来想一想,这个地方是否更应该抛出一个异常

stackoverflow链接:
http://stackoverflow.com/questions/271526/avoiding-null-statements-in-java?page=2&tab=votes#tab-top
http://stackoverflow.com/questions/271526/avoiding-null-statements-in-java?page=2&tab=votes#tab-top
Loading