package practicejava;
public class Query {
public static void main(String[] args) {
char ch = 66;
System.out.println("character= " + ch);
ch++;
System.out.println("character = " + ch);
}
}
Run Code Online (Sandbox Code Playgroud)
从技术上讲ch++;,它ch=ch+1;是相同的,但为什么我写作时会出现错误ch=ch+1;而不是ch++;?
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Run Code Online (Sandbox Code Playgroud)
在上面的例子中,我们使用的println方法没有导入它的包.所以我想知道:自动包含哪些包或类?
class Test {
public static void main(String[] args) {
long[] longarr = {40, 50, 70, 90};
int sum = 0;
for (int x: (int) longarr) {
sum += x;
}
System.out.println("sum is " + sum);
}
}
Run Code Online (Sandbox Code Playgroud)
如何在不将long类型数组设置为int的情况下修复错误.有没有办法这样做?