开始使用免费开始使用

安全性检查

您想确认要访问的网站是否安全。所有尝试启用安全的站点都以 https:// 开头。不安全的则以 http:// 开头(注意没有那个 s)。

本练习是课程的一部分

Java 中级

查看课程

练习说明

  • url 字符串中字符 's' 的正确索引赋给变量 charPosition
  • url 字符串上使用合适的 String 方法,提取该位置的字符并将其打印出来。

交互式实操练习

通过完成这段示例代码来试试这个练习。

class SecurityChecker {
  public static void main(String[] args) {
    String url = "https://www.datacamp.com";
    // Enter the right position to retrieve the 's' of the above url
    int charPosition = ____;

    System.out.println("s means secure : ");
    // Enter the correct method on url to find the security character
    System.out.println(url.____(charPosition));
  }
}
编辑并运行代码