為什么運行出來都是亂碼
public class HelloWorld {
? ? public static void main(String[] args) {
int one = 20 ;
? ? if( one % 2 == 0){
? ? ? ? System.out.println("one是偶數(shù)");
? ? }
}
public class HelloWorld {
? ? public static void main(String[] args) {
int one = 20 ;
? ? if( one % 2 == 0){
? ? ? ? System.out.println("one是偶數(shù)");
? ? }
}
2016-01-10
舉報
2016-01-11
public class HelloWorld {
? ? public static void main(String[] args) {
int one = 20 ;
? ? ? ? if(one%2==0){
? ? ? ? ? ? System.out.println("one是偶數(shù)");
? ? ? ? }
}
}
對一下 ?你的if(one%2==0) ?你的括號一個是英文,一個是中文,要統(tǒng)一用英文的。還有少了個大括號}
2016-01-10
public class HelloWord {
? ? public static void main(String[] args) {
? ? int one = 20 ;
? ? if( one % 2 == 0){
? ? System.out.println("one是偶數(shù)");
? ? }
? ?}
}
完整拷過去再試一下
2016-01-10
這兒你的括號好像用的中文括號。改為英文的把。
然后最后少了一個花括號。
如果在命令行編譯的時候有亂碼,把文件另存為ANSI編碼格式。
2016-01-10
編碼格式改為UTF-8