lab1跟着流程走了一遍,但是一直不知道自己的code是对是错,求大佬帮忙看一眼,谢谢!
public class HelloWorld {
public static void main(String[] args) {
System.out.println("hello world");
}
}
/*
1. All code in Java must be part of a class.
2. We delimit the beginning and end of segments of code using { and }.
3. All statements in Java must end in a semi-colon.
4. For code to run we need
*/
public class HelloNumbers {
public static void main(String[] args) {
int x = 0;
while (x < 10) {
System.out.println(x);
x = x +1;
}
}
}
/*
1. Before Java variables can be used, they must be declared.
2. Java variables must have a specific type.
3. Java variable types can never change.
4. Types are verified before the code even runs!!!
*/