1)把一个英语句子中的单词次序颠倒后输出。例如输入“how are you”,输出“you are how”; (2)编写单元测试进行测试; (3)用ElcEmma查看代码覆盖率,要求覆盖率达到100

package two;java

 

import java.util.Scanner;app

 

public class TestTwo {spa

   

 

 

    public static void Testtwo(String str) {it

        // TODO Auto-generated method stubio

       

   

       

       

        String[] strArr = str.split("\\s+|[,]");class

        StringBuffer result = new StringBuffer();test

        for(int i = strArr.length -1;i >=0; i--){import

        result.append(strArr[i] + " ");im

        }static

        result.setCharAt(str.length()-0, (char) 0);

        System.out.println("颠倒顺序后的结果为:"+result.toString());

        }

        }

 

 

package two;

 

import static org.junit.Assert.*;

 

 

 

 

import org.junit.Test;

 

public class TestTwoTest {

 

    @Test

    public void test() {

       

        String str = "how are you";

        TestTwo.Testtwo(str);

    }

 

}

相关文章
相关标签/搜索