Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

一些校正 #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions 4 contents/breaking-out-of-nested-loops-in-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ for (Type type : types) {

###回答

可以用brea+label的语法,例子如下
可以用break+label的语法,例子如下
```java
public class Test {
public static void main(String[] args) {
Expand All @@ -36,4 +36,4 @@ public class Test {
首先在for循环前加标签,如例子中的outerloop,然后在for循环内break label(如本例的outerloop),就会跳出该label指定的for循环。

stackoverflow链接:
http://stackoverflow.com/questions/886955/breaking-out-of-nested-loops-in-java
http://stackoverflow.com/questions/886955/breaking-out-of-nested-loops-in-java
4 changes: 2 additions & 2 deletions 4 contents/generating-random-integers-in-a-range-with-Java.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int num =(int)(Math.random() * 11);
```

那如何产生 “5= 随机数 <= 10” 的随机数呢?
那如何产生 “5 <= 随机数 <= 10” 的随机数呢?

```
int num = 5 + (int)(Math.random() * 6);
Expand All @@ -29,7 +29,7 @@ int num = min + (int)(Math.random() * (max-min+1));

Random 是 java 提供的一个伪随机数生成器。

生成 “min <= 随机数 <= max ” 的随机数:
生成 “ min <= 随机数 <= max ” 的随机数:

```
import java.util.Random;
Expand Down
4 changes: 2 additions & 2 deletions 4 contents/how-do-i-compare-strings-in-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ new String("test") == new String("test") // --> false
```

###其他
- 如何你重写了equal方法,记得相对应地修改hashcode方法,否则将会违反这两个方法的对等关系,如果两个对象是相等(equal)的,那么两个对象调用hashCode必须产生相同的整数结果,即:equal为true,hashCode必须为true,equal为false,hashCode也必须为false
- 如果要忽略大小写进行对比,可以用equalsIgnoreCase()方法
- 如果你重写了equal方法,记得相对应地修改hashcode方法,否则将会违反这两个方法的对等关系,如果两个对象是相等(equal)的,那么两个对象调用hashCode必须产生相同的整数结果,即:equal为true,hashCode必须为true,equal为false,hashCode也必须为false
- 如果要忽略大小写进行对比,可以用equalsIgnoreCase()方法
Morty Proxy This is a proxified and sanitized view of the page, visit original site.