运行Java程序时出错

运行Java程序时出错,java,syntax-error,Java,Syntax Error,我已经编写了一个Java程序,但是当我运行它时,第一个字符串MWTs中有很多错误。我做了很多改变,但仍然不成功。有人能帮我吗 我的源代码部分: import java.util.*; import java.io.*; class Countwords { public static String [] MWTs = {"Hong Kong","New York","United Kingdom", "Basic Law","Poeple's Republic of Chin

我已经编写了一个Java程序,但是当我运行它时,第一个字符串
MWTs
中有很多错误。我做了很多改变,但仍然不成功。有人能帮我吗

我的源代码部分:

import java.util.*;
import java.io.*;

class Countwords {
    public static String [] MWTs = {"Hong Kong","New York","United Kingdom", 
    "Basic Law","Poeple's Republic of China", 
    "Hong Kong Special Adminstrative Region","Chief Excutive", 
    "Chief Justice","Chief Secretary for Adminstrative",
    "Interpretation and General Clauses Ordinance", 
    "Hong Kong Bill of Rights","Central People's Government of the People's Republic of China",
    "Administrative Appeals Board", "Chief Executive in Council","Executive Council"
    "Court of Final Appeal","Court of First Instance","District Council",
    "District Court", "District Judge","Financial Secretary",
    "Hong Kong Government Gazette", "Gazette Extraordinary", "Special Gazette",
    "General Holidays Ordinance", "Financial Services and the Treasury", "Government Logistics Department",
    "Deputy Director", "Assistant Director of Health", "High Court","Ministry of Foreign Affairs",
    "New Kowloon", "New Territories","Provisional Legislative Council",
    "District Council", "Executive Council","Central Authorities","Hong Kong Time",
    "Financial Secretary", "Secretary for Justice", "Secretary for the Civil Service",
    "Secretary for Commerce, Industry and Technology","Secretary for Constitutional Affairs",
    "Secretary for Economic Development and Labour", "Secretary for Education and Manpower",
    "Secretary for the Environment, Transport and Works", "Secretary for Financial Services and the Treasury",
    "Secretary for Health, Welfare and Food", "Secretary for Home Affairs", 
    "Secretary for Housing, Planning and Lands", "Secretary for Security",
    "Permanent Secretary", "Director of Home Affairs", "Director of Administration",
    "Deputy Secretary", "Deputy Director of Administration", "Principal Assistant Secretary",
    "Assistant Director of Administration", "Independent Commission Against Corruption", 
    "Principal Investigator", "Operations Department", "Immigration Service", "Customs and Excise Service",
    "Chief Superintendent", "Customs and Excise Service ","Her Majesty", "British Governmen", "Secretary of State",
    "Privy Council", "Her Majesty in Counci", "British Dependent Territories","Channel Islands", "Isle of Man", "British Nationality Act",
    "United Kingdom of Great Britain and Northern Ireland", 
    "Northern Ireland", "Administrative Appeals Rules", "Public Office Ordinance", "Chief Justice Bankruptcy Ordinance", 
    };

    public static void bubble_sort_length(String [] strs){
        while (true) {
            int swaps = 0;
            for (int i=0; i<strs.length -1; i++){
                if (strs[i].length() >= strs[i+1].length())
                    continue;
                String tmp = strs[i];
                strs[i]    = strs[i+1];
                strs[i+1]  = tmp;
                swaps++;
            }
            if (swaps == 0) break;
        }
    }
import java.util.*;
导入java.io.*;
类计数词{
公共静态字符串[]MWTs={“香港”、“纽约”、“英国”,
"基本法","中华人民共和国",,
“香港特别行政区”、“行政长官”,
“首席大法官”、“政务司司长”,
“释义及通则条例”,
《香港人权法案》,《中华人民共和国中央人民政府》,
“行政上诉委员会”、“行政长官会同行政会议”、“行政会议”
“终审法院”、“原讼法庭”、“区议会”,
“区域法院”、“区域法院法官”、“财政司”,
“香港政府宪报”、“特别宪报”、“特别宪报”,
"公众假期条例","财经事务及库务署","政府物流署",,
“副局长”、“卫生署助理署长”、“高等法院”、“外交部”,
“新九龙”、“新界”、“临时立法会”,
“区议会”、“行政会议”、“中央当局”、“香港时间”,
“财政司司长”、“律政司司长”、“公务员事务局局长”,
“工商及科技局局长”、“政制事务局局长”,
“经济发展及劳工局局长”、“教育统筹局局长”,
“环境运输及工务局局长”、“财经事务及库务局局长”,
“卫生福利及食物局局长”、“民政事务局局长”,
“房屋及规划地政局局长”、“保安局局长”,
“常任秘书长”、“民政事务总署署长”、“行政署长”,
“副秘书”、“副行政署长”、“首席助理秘书”,
“助理行政署长”、“廉政公署”,
“首席调查员”、“行动处”、“入境事务处”、“海关总署”,
“总警司”、“海关”、“女王陛下”、“英国总督”、“国务卿”,
“枢密院”、“枢密院女皇陛下”、“英国属土”、“海峡群岛”、“马恩岛”、“英国国籍法”,
“大不列颠及北爱尔兰联合王国”,
“北爱尔兰”、“行政上诉规则”、“公职条例”、“首席大法官破产条例”,
};
公共静态无效气泡\u排序\u长度(字符串[]strs){
while(true){
int-swaps=0;
对于(int i=0;i=strs[i+1].length())
继续;
字符串tmp=strs[i];
strs[i]=strs[i+1];
strs[i+1]=tmp;
交换++;
}
如果(互换==0)中断;
}
}

试试这个片段。问题在于格式和语法

import java.util.*;
import java.io.*;

class Countwords {
    public static String[] MWTs = { "Hong Kong", "New York", "United Kingdom",
            "Basic Law", "Poeple's Republic of China",
            "Hong Kong Special Adminstrative Region", "Chief Excutive",
            "Chief Justice", "Chief Secretary for Adminstrative",
            "Interpretation and General Clauses Ordinance",
            "Hong Kong Bill of Rights",
            "Central People's Government of the People's Republic of China",
            "Administrative Appeals Board", "Chief Executive in Council",
            "Executive Council", "Court of Final Appeal",
            "Court of First Instance", "District Council", "District Court",
            "District Judge", "Financial Secretary",
            "Hong Kong Government Gazette", "Gazette Extraordinary",
            "Special Gazette", "General Holidays Ordinance",
            "Financial Services and the Treasury",
            "Government Logistics Department", "Deputy Director",
            "Assistant Director of Health", "High Court",
            "Ministry of Foreign Affairs", "New Kowloon", "New Territories",
            "Provisional Legislative Council", "District Council",
            "Executive Council", "Central Authorities", "Hong Kong Time",
            "Financial Secretary", "Secretary for Justice",
            "Secretary for the Civil Service",
            "Secretary for Commerce, Industry and Technology",
            "Secretary for Constitutional Affairs",
            "Secretary for Economic Development and Labour",
            "Secretary for Education and Manpower",
            "Secretary for the Environment, Transport and Works",
            "Secretary for Financial Services and the Treasury",
            "Secretary for Health, Welfare and Food",
            "Secretary for Home Affairs",
            "Secretary for Housing, Planning and Lands",
            "Secretary for Security", "Permanent Secretary",
            "Director of Home Affairs", "Director of Administration",
            "Deputy Secretary", "Deputy Director of Administration",
            "Principal Assistant Secretary",
            "Assistant Director of Administration",
            "Independent Commission Against Corruption",
            "Principal Investigator", "Operations Department",
            "Immigration Service", "Customs and Excise Service",
            "Chief Superintendent", "Customs and Excise Service ",
            "Her Majesty", "British Governmen", "Secretary of State",
            "Privy Council", "Her Majesty in Counci",
            "British Dependent Territories", "Channel Islands", "Isle of Man",
            "British Nationality Act",
            "United Kingdom of Great Britain and Northern Ireland",
            "Northern Ireland", "Administrative Appeals Rules",
            "Public Office Ordinance", "Chief Justice Bankruptcy Ordinance", };

    public static void bubble_sort_length(String[] strs) {
        while (true) {
            int swaps = 0;
            for (int i = 0; i < strs.length - 1; i++) {
                if (strs[i].length() >= strs[i + 1].length())
                    continue;
                String tmp = strs[i];
                strs[i] = strs[i + 1];
                strs[i + 1] = tmp;
                swaps++;
            }
            if (swaps == 0)
                break;
        }
    }

    public static void main(String[] args) {
        bubble_sort_length(MWTs);
        System.out.println(Arrays.toString(MWTs));
    }
}
import java.util.*;
导入java.io.*;
类计数词{
公共静态字符串[]MWTs={“香港”、“纽约”、“英国”,
"基本法","中华人民共和国",,
“香港特别行政区”、“行政长官”,
“首席大法官”、“政务司司长”,
“释义及通则条例”,
“香港人权法案”,
“中华人民共和国中央人民政府”,
“行政上诉委员会”、“行政长官会同行政会议”,
“行政会议”、“终审法院”,
“原讼法庭”、“区议会”、“区域法院”,
“地区法官”、“财政司司长”,
"香港政府宪报","特别宪报",,
"特别宪报","公众假期条例",,
“金融服务和财政部”,
"政府物流署","副署长",,
“卫生署助理署长”、“高等法院”,
“外交部”、“新九龙”、“新界”,
“临时立法会”、“区议会”,
“行政会议”、“中央当局”、“香港时间”,
“财政司司长”、“律政司司长”,
“公务员事务局局长”,
“工商及科技局局长”,
“政制事务局局长”,
“经济发展及劳工局局长”,
“教育统筹局局长”,
“环境运输及工务局局长”,
“财经事务及库务局局长”,
“卫生福利及食物局局长”,
“民政事务局局长”,
“房屋及规划地政局局长”,
“保安局局长”、“常任秘书长”,
“民政事务总署署长”、“行政署长”,
“副秘书长”、“副行政署长”,
“首席助理秘书”,
“助理行政署长”,
“廉政公署”,
“首席调查员”、“运营部”,
“入境事务处”、“海关总署”,
"总警司","香港海关",,
“女王陛下”、“英国总督”、“国务卿”,
“枢密院”、“枢密院女皇陛下”,
“英国属土”、“海峡群岛”、“马恩岛”,
“英国国籍法”,
“大不列颠及北爱尔兰联合王国”,
“北伊雷拉