我是Java新手,我无法理解这个结构:
public static int[] upperCounter(String str) {
final int NUMCHARS = 26;
int[] upperCounts = new int[NUMCHARS];
char c;
for (int i = 0; i < str.length(); i++) {
c = str.charAt(i);
if (c >= 'A' && c <= 'Z')
upperCounts[c-'A']++;
}
return upperCounts;
}
Run Code Online (Sandbox Code Playgroud)
这种方法有效,但list[c-'A']++;意味着什么?
对于这种情况,我希望“第四项任务”位于“第一项任务”之下。我应该怎么做才能实现这一目标?谢谢。
<div class="list">
<div class="card"><h5>First Task</h5></div>
<div class="card"><h5>Second Task</h5></div>
<div class="card"><h5>Third Task</h5></div>
<div class="card"><h5>Fourth Task</h5></div>
</div>
.list {
width: 600px;
height: 400px;
background-color: yellow;
display: flex;
flex-wrap: wrap;
}
.card {
background-color: blue;
border: solid black 2px;
flex: 0 0 185px;
height: 69px;
}
Run Code Online (Sandbox Code Playgroud)