Bắt đầu ngayBắt đầu miễn phí

Security checking

You want to make sure that the site you are trying to visit is secure. All websites which try to be secure start with https://. Those that don't start with http:// (notice the absence of the s).

Bài tập này là một phần của khóa học

Intermediate Java

Xem khóa học

Hướng dẫn bài tập

  • Assign the correct index of the character 's' in the url string to the variable charPosition.
  • Use the appropriate String method on the url string to extract the character at that position and print it.

Bài tập tương tác thực hành trực tiếp

Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.

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));
  }
}
Chỉnh sửa và Chạy Mã