Domain checking
You are planning your summer vacation and need to secure some permits. So you want to make sure that a site is from the US government to be sure of its legitimacy. You've been told they all use the ".gov" domain, and that only government sites can use it.
Bu egzersiz
Intermediate Java
kursunun bir parçasıdırEgzersiz talimatları
- Check that the given
urlcontains".gov"as a substring. Use the variabletoFindto do that.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
class DomainChecker {
public static void main(String[] args) {
String toFind = ".gov";
String url = "https://www.usa.gov/holidays";
// Use the right function to check if our url contains the .gov domain
System.out.println(url.____(toFind));
}
}