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

    package two;

     

    import java.util.Scanner;

     

    public class TestTwo {

       

     

     

        public static void Testtwo(String str) {

            // TODO Auto-generated method stub

           

       

           

           

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

            StringBuffer result = new StringBuffer();

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

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

            }

            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);

        }

     

    }

  • 相关阅读:
    android 颜色值参考,(有颜色图
    Virtual address cache memory, processor and multiprocessor
    VUEJS2.0源码理解--优
    qlserver、Mysql、Oracle三种数据库的优缺点总结
    三层与MVC
    数据结构 常用定义
    c语言 typedef
    C动态内存分配
    c 指针(一)
    stdlib 头文件
  • 原文地址:https://www.cnblogs.com/my-maple/p/5326980.html
Copyright © 2011-2022 走看看