Get startedGet started for free

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

This exercise is part of the course

Intermediate Java

View Course

Exercise instructions

  • Extract the fifth character of the url, then print it to know whether the site is secure or not.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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));
  }
}
Edit and Run Code