{"id":77584,"date":"2020-04-04T15:13:48","date_gmt":"2020-04-04T09:43:48","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=77584"},"modified":"2020-04-04T15:13:48","modified_gmt":"2020-04-04T09:43:48","slug":"java-url-class","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/","title":{"rendered":"Java URL Class &#8211; Learn how to Address your resources on Internet"},"content":{"rendered":"<p>We all know a URL is a unique string of text that acts as an identity for all the resources on the Internet. URL helps in addressing the resources available on the Internet. In this article, we will cover the Java URL class which acts as a medium to connect to the internet.<\/p>\n<p>Also, we will learn how to write Java programs that communicate with a URL (Uniform Resource Locator). We will also study what is URL and various segments of the URL. We will explore the URL class and URLConnection class in Java with examples for better understanding.<\/p>\n<h3>What is the URL?<\/h3>\n<p>URL, an acronym for Uniform Resource Locator, is a reference or address to unique resources such as a file, HTML page, or a document, etc. on the World Wide Web (network). The format of URL is in the string that describes the process to search for resources on the internet.<\/p>\n<h4>Segments of a URL<\/h4>\n<p>A URL can have numerous components. But it is mainly a three-segment framework and they are:<\/p>\n<ul>\n<li><strong>Protocol:<\/strong> HTTP (HyperText Transport Protocol) is the convention here. HTTP, HTTPS, FTP, and File are some examples of protocols.<\/li>\n<li><strong>Hostname or Server Name:<\/strong> Name of the server machine on which the resources are present.<\/li>\n<li><strong>File Name:<\/strong> The way name to the record on the machine.<\/li>\n<li><strong>Port Number:<\/strong> Port number is a number through which the URL connects to the web. If the URL does not specify any specific port, then the default port number is used.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/04\/methods-of-java-url-class.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77913\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/04\/methods-of-java-url-class.jpg\" alt=\"\" width=\"802\" height=\"420\" \/><\/a><\/p>\n<h3>What is Java URL Class?<\/h3>\n<p>Java URL class is the gateway to access the resources on the web. The object of the <strong>java.net.URL<\/strong> class represents the URL and this object manages all the information present in the URL string. There are many methods in the Java URL class to create the object of the URL class.<\/p>\n<h4>Constructors of Java URL Class<\/h4>\n<table class=\"tv-table-center\">\n<tbody>\n<tr>\n<td><b>S.N<\/b><\/td>\n<td><b>Constructor<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><b>1<\/b><\/td>\n<td><span style=\"font-weight: 400\">URL(String address) throwsMalformedURLException<\/span><\/td>\n<td><span style=\"font-weight: 400\">It creates a URL object from the given input\u00a0 String.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>2<\/b><\/td>\n<td><span style=\"font-weight: 400\">URL(String protocol, String host, String file)<\/span><\/td>\n<td><span style=\"font-weight: 400\">This constructor creates a URL object from the given input protocol, host, and file name.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>3<\/b><\/td>\n<td><span style=\"font-weight: 400\">URL(String protocol, String host, int port, String file)<\/span><\/td>\n<td><span style=\"font-weight: 400\">This constructor creates a URL object from the specified protocol, hostname, port number and filename.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>4<\/b><\/td>\n<td><span style=\"font-weight: 400\">URL(URL context, String spec)<\/span><\/td>\n<td><span style=\"font-weight: 400\">It makes a URL object by parsing the given String spec in the given context.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>5<\/b><\/td>\n<td><span style=\"font-weight: 400\">URL(String protocol, String host, int port, String file, URLStreamHandler handler)<\/span><\/td>\n<td><span style=\"font-weight: 400\">This constructor makes a URL object from the specified protocol, hostname, port number, file, and handler<\/span><span style=\"font-weight: 400\">.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>6<\/b><\/td>\n<td><span style=\"font-weight: 400\">URL(URL context, String spec, URLStreamHandler handler)<\/span><\/td>\n<td><span style=\"font-weight: 400\">Makes a URL by parsing the given spec with the given input handler inside the given context.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Methods of Java URL Class<\/h4>\n<table class=\"tv-table-center\">\n<tbody>\n<tr>\n<td><b>S.N<\/b><\/td>\n<td><b>Method Name<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><b>1<\/b><\/td>\n<td><span style=\"font-weight: 400\">public String toString()<\/span><\/td>\n<td><span style=\"font-weight: 400\">The toString() method returns the given URL object in the string form.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>2<\/b><\/td>\n<td><span style=\"font-weight: 400\">public String getPath()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the path of the URL. It returns null if the URL is empty.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>3<\/b><\/td>\n<td><span style=\"font-weight: 400\">public String getQuery()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method gives the query part of the URL. A query is a part of the URL after the \u2018?\u2019 in the URL.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>4<\/b><\/td>\n<td><span style=\"font-weight: 400\">public String getAuthority()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the authority part of the URL and null if it is empty.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>5<\/b><\/td>\n<td><span style=\"font-weight: 400\">public String getHost()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method gives the hostname associated with the URL in IPv6 format<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>6<\/b><\/td>\n<td><span style=\"font-weight: 400\">public String getFile()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the filename of the URL.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>7<\/b><\/td>\n<td><span style=\"font-weight: 400\">Public int getPort()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the port number of the URL.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>8<\/b><\/td>\n<td><span style=\"font-weight: 400\">Public int getDefaultPort()\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the default port number used by the URL.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>9<\/b><\/td>\n<td><span style=\"font-weight: 400\">Public String getRef()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the reference to the URL object. The reference is the part represented by \u2018#\u2019 in the URL.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>10<\/b><\/td>\n<td><span style=\"font-weight: 400\">Public String getProtocol()<\/span><\/td>\n<td><span style=\"font-weight: 400\">It returns the protocol associated with the URL.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Creating URL With Component Parts<\/h4>\n<p>We will learn how to create a URL using URL components such as hostname, filename, and protocol.<\/p>\n<p><strong>Code to Create a URL using URL Components:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.urlclass;\nimport java.net.MalformedURLException;\nimport java.net.URL;\npublic class URLClassDemo\n{\n  public static void main(String[ ] args) throws MalformedURLException\n  {\n    String protocol = \"http\";\n    String host = \"techvidvan.com\";\n    String file = \"\/tutorials\/java-method-overriding\/\";\n    URL url = new URL(protocol, host, file);\n    System.out.println(\"URL is: \" +url.toString());\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">URL is:<br \/>\nhttp:\/\/techvidvan.com\/tutorials\/java-method-overriding\/<\/div>\n<h5>An Example of the URL Class of Java<\/h5>\n<p>After looking at the methods and constructors of the URL class in Java, in the following code, we will understand the use of each method of the URL class.<\/p>\n<p><strong>Code to understand URL Class in Java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.urlclass;\nimport java.net.MalformedURLException;\nimport java.net.URL;\npublic class URLClassDemo\n{\n  public static void main(String[] args) throws MalformedURLException\n  {\n    URL url1 = new URL(\"https:\/\/techvidvan.com\/tutorials\/java-polymorphism\/\");\n\n    System.out.println(\"url1 is: \" +url1.toString());\n\n    System.out.println(\"\\nDifferent components of the url1\");\n    System.out.println(\"Protocol: \" + url1.getProtocol());\n    System.out.println(\"Hostname: \" + url1.getHost());\n    System.out.println(\"Port: \" + url1.getPort());\n    System.out.println(\"Default port: \" + url1.getDefaultPort());\n    System.out.println(\"Query: \" + url1.getQuery());\n    System.out.println(\"Path: \" + url1.getPath());\n    System.out.println(\"File: \" + url1.getFile());\n    System.out.println(\"Reference: \" + url1.getRef());\n    System.out.println(\"Authority: \" + url1.getAuthority());\n\n    URL url2 = new URL(\"https:\/\/www.google.com\/search?\t\tq=techvidvan&amp;oq=techvidva&amp;aqs=chrome.1.69i57j0.7491j0j7&amp;sourceid=chrome&amp;i\t\te=UTF-8\");\n\n    System.out.println(\"\\nurl2 is: \" +url2.toString());\n\n    System.out.println(\"\\nDifferent components of the url2\");\n    System.out.println(\"Protocol: \" + url2.getProtocol());\n    System.out.println(\"Hostname: \" + url2.getHost());\n    System.out.println(\"Port: \" + url2.getPort());\n    System.out.println(\"Default port: \" + url2.getDefaultPort());\n    System.out.println(\"Query: \" + url2.getQuery());\n    System.out.println(\"Path: \" + url2.getPath());\n    System.out.println(\"File: \" + url2.getFile());\n    System.out.println(\"Reference: \" + url2.getRef());\n    System.out.println(\"Authority: \" + url2.getAuthority());\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">url1 is: https:\/\/techvidvan.com\/tutorials\/java-polymorphism\/Different components of the url1<br \/>\nProtocol: https<br \/>\nHostname: techvidvan.com<br \/>\nPort: -1<br \/>\nDefault port: 443<br \/>\nQuery: null<br \/>\nPath: \/tutorials\/java-polymorphism\/<br \/>\nFile: \/tutorials\/java-polymorphism\/<br \/>\nReference: null<br \/>\nAuthority: techvidvan.comurl2 is: https:\/\/www.google.com\/search?q=techvidvan&amp;oq=techvidva&amp;aqs=chrome.1.69i57j0.7491j0j7&amp;sourceid=chrome&amp;ie=UTF-8<\/p>\n<p>Different components of the url2<br \/>\nProtocol: https<br \/>\nHostname: www.google.com<br \/>\nPort: -1<br \/>\nDefault port: 443<br \/>\nQuery: q=techvidvan&amp;oq=techvidva&amp;aqs=chrome.1.69i57j0.7491j0j7&amp;sourceid=chrome&amp;ie=UTF-8<br \/>\nPath: \/search<br \/>\nFile: \/search?q=techvidvan&amp;oq=techvidva&amp;aqs=chrome.1.69i57j0.7491j0j7&amp;sourceid=chrome&amp;ie=UTF-8<br \/>\nReference: null<br \/>\nAuthority: www.google.com<\/p>\n<\/div>\n<h4>URLConnection Class in Java<\/h4>\n<p>The URLConnection class in Java helps to represent a <em>\u201cconnection or communication\u201d<\/em> between the application and the URL. This class also helps us to read and write data to the specified resource of URL.<\/p>\n<p><strong>java.net.URLConnection<\/strong> is an abstract class whose subclasses represent the various types of URL connections.<\/p>\n<p><strong>For example:<\/strong><\/p>\n<ul>\n<li>The openConnection() method returns the object of the HttpURLConnection class if you connect to a URL with the HTTP protocol.<\/li>\n<li>Also, this openConnection() method returns the object of a JarURLConnection class if you connect to a URL of a JAR file.<\/li>\n<\/ul>\n<h5>The OpenConnection() Method<\/h5>\n<p>We can get the object or instance of the URLConnection class with the <strong>open Connection()<\/strong> method of URL class.<\/p>\n<p><strong>Syntax of this method is:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public URLConnection openConnection() throws IOException { }<\/pre>\n<h5>Methods of URLConnection Class in Java<\/h5>\n<p>There are many methods in the URLConnection to set or retrieve the details about the connection. These methods are:<\/p>\n<table class=\"tv-table-center\">\n<tbody>\n<tr>\n<td><b>S.N.<\/b><\/td>\n<td><b>Method\u00a0<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><b>1<\/b><\/td>\n<td><span style=\"font-weight: 400\">Object getContent()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the contents of this URL connection.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>2<\/b><\/td>\n<td><span style=\"font-weight: 400\">String getContentEncoding()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the value of the content-encoding header field in String form.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>3<\/b><\/td>\n<td><span style=\"font-weight: 400\">int getContentLength()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method gives the value of the content-length header field in the String form.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>4<\/b><\/td>\n<td><span style=\"font-weight: 400\">String getContentType()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the value of the content-type header field.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>5<\/b><\/td>\n<td><span style=\"font-weight: 400\">int getLastModified()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method gives the value of the last-modified header field.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>6<\/b><\/td>\n<td><span style=\"font-weight: 400\">long getExpiration()<\/span><\/td>\n<td><span style=\"font-weight: 400\">It returns the value of the expired header field.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>7<\/b><\/td>\n<td><span style=\"font-weight: 400\">long getIfModifiedSince()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the value of this object&#8217;s ifModifiedSince field.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>9<\/b><\/td>\n<td><span style=\"font-weight: 400\">public void setDoInput(boolean input)<\/span><\/td>\n<td><span style=\"font-weight: 400\">We pass the parameter true to this method\u00a0 to specify that we will use the connection input.\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>10<\/b><\/td>\n<td><span style=\"font-weight: 400\">public void setDoOutput(boolean output)<\/span><\/td>\n<td><span style=\"font-weight: 400\">We pass the parameter true to this method\u00a0 to specify that we will use the connection output.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>11<\/b><\/td>\n<td><span style=\"font-weight: 400\">public InputStream getInputStream() throws IOException<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method returns the input stream of the URL connection for reading from the resource.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>12<\/b><\/td>\n<td><span style=\"font-weight: 400\">public OutputStream getOutputStream() throws IOException<\/span><\/td>\n<td><span style=\"font-weight: 400\">It returns the output stream of the URL connection for writing to the resource.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>13<\/b><\/td>\n<td><span style=\"font-weight: 400\">public URL getURL()<\/span><\/td>\n<td><span style=\"font-weight: 400\">Returns the URL that of this connected URLConnection object.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>Example of URLConnection Class<\/h5>\n<p>The following URLConnectionDemo class connects to an input URL. If an HTTP resource is present in a URL represents, then connection casts to HttpURLConnection. The data in the resource reads one line at a time.<\/p>\n<p><strong>Code to understand URLConnection class of Java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.urlclass;\nimport java.net.*;\nimport java.io.*;\npublic class URLConnectionDemo\n{\n  public static void main(String[] args) throws MalformedURLException\n  {\n    try\n    {\n      URL url = new URL(\"https:\/\/www.techvidvan.com\");\n      URLConnection urlConnection = url.openConnection();\n      HttpURLConnection connection = null;\n      if(urlConnection instanceof HttpURLConnection)\n      {\n        connection = (HttpURLConnection) urlConnection;\n      }\n      else\n      {\n        System.out.println(\"Please enter an HTTP URL.\");\n        return;\n      }\n\n      BufferedReader in = new BufferedReader(\n          new InputStreamReader(connection.getInputStream()));\n      String urlString = \" \";\n      String current;\n\n      while((current = in.readLine()) != null)\n      {\n        urlString += current;\n      }\n      System.out.println(urlString);\n    } catch (IOException e)\n    {\n      e.printStackTrace();\n    }\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">&#8230;..a complete HTML content of the home page of techvidvan.com&#8230;..<\/div>\n<h3>Summary<\/h3>\n<p>The URL class is used in Java to access network resources programmatically. There are many parts or segments of URL which uniquely identify a URL.<\/p>\n<p>In this tutorial, we learned about the Java URL class in Java along with its constructors and methods. We studied how to create a URL with the help of its components.<\/p>\n<p>There is also a URLConnection class that connects an application with a URL.It also has some methods that we covered in our article. Both URLClass and URLConnection classes are being explained with the example codes in this article.<\/p>\n<p>Thank you for reading our article. Do share this article on Social Media.<\/p>\n<p>Happy Learning \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We all know a URL is a unique string of text that acts as an identity for all the resources on the Internet. URL helps in addressing the resources available on the Internet. In&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":77913,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[2214,2215,2216,2217,2218,2219,2220],"class_list":["post-77584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-java-url-class","tag-java-url-class-constructors","tag-java-url-class-example","tag-java-url-class-methods","tag-url-class-in-java","tag-what-is-java-url-class","tag-what-is-url"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java URL Class - Learn how to Address your resources on Internet - TechVidvan<\/title>\n<meta name=\"description\" content=\"Learn about Java URL Class along with its constructors, methods &amp; know how to create a URL with the help of its components explained with coding examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/java-url-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java URL Class - Learn how to Address your resources on Internet - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Learn about Java URL Class along with its constructors, methods &amp; know how to create a URL with the help of its components explained with coding examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/java-url-class\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-04T09:43:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/methods-of-java-url-class.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java URL Class - Learn how to Address your resources on Internet - TechVidvan","description":"Learn about Java URL Class along with its constructors, methods & know how to create a URL with the help of its components explained with coding examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/","og_locale":"en_US","og_type":"article","og_title":"Java URL Class - Learn how to Address your resources on Internet - TechVidvan","og_description":"Learn about Java URL Class along with its constructors, methods & know how to create a URL with the help of its components explained with coding examples.","og_url":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-04-04T09:43:48+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/methods-of-java-url-class.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Java URL Class &#8211; Learn how to Address your resources on Internet","datePublished":"2020-04-04T09:43:48+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/"},"wordCount":1341,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/methods-of-java-url-class.jpg","keywords":["Java URL Class","Java URL Class Constructors","Java URL Class Example","Java URL Class Methods","URL Class in Java","What is Java URL Class","What is URL"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/java-url-class\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/","url":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/","name":"Java URL Class - Learn how to Address your resources on Internet - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/methods-of-java-url-class.jpg","datePublished":"2020-04-04T09:43:48+00:00","description":"Learn about Java URL Class along with its constructors, methods & know how to create a URL with the help of its components explained with coding examples.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/java-url-class\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/methods-of-java-url-class.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/methods-of-java-url-class.jpg","width":802,"height":420,"caption":"java url"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/java-url-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Java URL Class &#8211; Learn how to Address your resources on Internet"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/77584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=77584"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/77584\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/77913"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=77584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=77584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=77584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}