codewars解题笔记---Function 1 - hello world

Description:

Make a simple function called greet that returns the most-famous "hello world!".

Test Driven Development (TDD)

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.runners.JUnit4;

// TODO: Replace examples and use TDD development by writing your own tests

public class SolutionTest {
    @Test
    public void testSomething() {
        // assertEquals("expected", "actual");
    }
}

Solution:

public class HelloWorld {
  public static String greet() {
    //Make it say "hello world!"
  }
}

题目解说:

描述:

创建一个名为greet的简单函数,返回最著名的“hello world!”.

我的答案:

public class HelloWorld {
  public static String greet() {
    //Make it say "hello world!"
     return "hello world!";
  }
}

 

你可能感兴趣的:(codewars)