import java.util.*; class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter a website: "); String website = sc.next(); if(website.endsWith(".com")){ System.out.println("This is a commercial website"); }else if(website.endsWith(".org")){ System.out.println("This is an organization website"); }else if(website.endsWith(".in")){ System.out.println("This is an indian website"); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter