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

Commit fdee481

Browse filesBrowse files
committed
优化“给3个布尔变量,当其中有2个或者2个以上为true才返回true”
1 parent 173b9fc commit fdee481
Copy full SHA for fdee481

File tree

Expand file treeCollapse file tree

2 files changed

+5
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-3
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ stackoverflow-Java-top-qa
4242
* [获取完整的堆栈信息](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/get-current-stack-trace-in-java.md)
4343
* [如何用一行代码初始化一个ArrayList](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/initialization-of-an-arraylist-in-one-line.md)
4444
* [初始化静态map](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/How-can-I-Initialize-a-static-Map.md)
45+
* [给3个布尔变量,当其中有2个或者2个以上为true才返回true](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/Check-if-at-least-two-out-of-three-booleans-are-true.md)
4546

4647

4748
> 网络

‎contents/Check-if-at-least-two-out-of-three-booleans-are-true.md

Copy file name to clipboardExpand all lines: contents/Check-if-at-least-two-out-of-three-booleans-are-true.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
给3个布尔变量,当其中有2个或者2个以上为true菜返回true
1+
##给3个布尔变量,当其中有2个或者2个以上为true才返回true
22
===
3-
问题
3+
###问题
44
给3个boolean变量,a,b,c,当其中有2个或2个以上为true时才返回true?
5-
最笨的方法:
5+
* 最笨的方法:
66
```java
77
boolean atLeastTwo(boolean a, boolean b, boolean c)
88
{
@@ -36,4 +36,5 @@ boolean atLeastTwo(boolean a, boolean b, boolean c)
3636
return a ? (b || c) : (b && c);
3737
```
3838

39+
3940
stackoverflow链接: http://stackoverflow.com/questions/3076078/check-if-at-least-two-out-of-three-booleans-are-true

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.