提交 33216fdb 编写于 作者: M Mars Liu

add some simple sources

上级 dcf0d3a2
{
"type": "code_options",
"author": "刘鑫",
"source": "app.md",
"exercise_id":"5d4f393434714b0fa3230ac8423db7cc"
}
\ No newline at end of file
# Java 程序的基本结构
以下选项中,有语法错误的是:
## 缺少必要的语法元素
```java
public App {
public static main(String[] args){
for(int i=0; i<10; i++){
System.out.println(i);
}
}
}
```
## B
```java
public class App {
public static void main(String[] args){
for(int i=0; i<10; i++){
System.out.println(i);
}
}
}
```
## C
```java
public class App {
public static void main(String[] args){
for(int i=0; i<10; i++){
System.out.println(i);
}
}
}
```
## D
```java
public class App {
public static int sum(int[] array){
int a = 0;
for(int i=0; i<array.length; i++){
a += array[i];
}
return a;
}
}
```
## E
```java
public class App {
public int sum(int[] array){
int a = 0;
for(int i=0; i<array.length; i++){
a += array[i];
}
return a;
}
}
```
## F
```java
public interface App {
default int sum(int[] array){
int a = 0;
for(int i=0; i<array.length; i++){
a += array[i];
}
return a;
}
}
```
\ No newline at end of file
......@@ -2,5 +2,5 @@
"node_id": "569d5e11c4fc5de7844053d9a733c5e8",
"keywords": [],
"children": [],
"export": []
"export": ["app.json"]
}
\ No newline at end of file
{
"type": "code_options",
"author": "刘鑫",
"source": "comment.md",
"exercise_id":"a666420ebe28430dab8ad4bd99306dfb"
}
\ No newline at end of file
# 注释语法
下面的注释文本中,错误的是:
# 使用了 Python 风格的注释
```java
package app;
# a simple class
public class App {
public static void main(String[] args){
System.out.println("Hello World");
}
}
```
# 单行注释
```java
package app;
// a simple class
public class App {
public static void main(String[] args){
System.out.println("Hello World");
}
}
```
# 多行注释
```java
package app;
/*
* Code for comments demo
* Author: Liu Xin <liuxin@csdn.net>
* Date: 2021-10-24
*/
public class App {
public static void main(String[] args){
System.out.println("Hello World");
}
}
```
# 代码内的注释
```java
package app;
public class App {
public static void main(String[] args){
// print 10 times
for(int i; i< 10; i++){
System.out.println(i);
}
}
}
```
# 注释混排
```java
package app;
public class App {
public static void main(String[] args){
for(int i; i< 10; i++){
if(i % 2 == 0) {
System.out.println(i*i); // print square value
}
}
}
}
```
\ No newline at end of file
......@@ -2,5 +2,5 @@
"node_id": "569d5e11c4fc5de7844053d9a733c5e8",
"keywords": [],
"children": [],
"export": []
"export": ["comment.json"]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册