{"id":77066,"date":"2020-03-05T15:59:22","date_gmt":"2020-03-05T10:29:22","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=77066"},"modified":"2020-03-05T15:59:22","modified_gmt":"2020-03-05T10:29:22","slug":"packages-in-java","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/","title":{"rendered":"Packages in Java &#8211; Types, Advantages &amp; Techniques to Access Packages"},"content":{"rendered":"<p>There are folders or directories in our computers for the classification and accessibility of various files, and in Java, we have packages for the same. In Java, Packages are similar to folders, which are mainly used to organize classes and interfaces.<\/p>\n<p>Packages help us to write better and manageable code by preventing naming conflicts. Java provides some built-in packages which we can use but we can also create our own (user-defined) packages.<\/p>\n<p>In this article, we are going to discuss everything about packages in Java along with their syntaxes and examples. Moving forth in this article we are going to learn &#8211;<\/p>\n<ol>\n<li>Packages in Java<\/li>\n<li>Advantages of using Packages in Java<\/li>\n<li>Types of Packages in Java<\/li>\n<li>Creating a Package in Java<\/li>\n<li>Example of Java Packages<\/li>\n<li>Package naming Conventions<\/li>\n<li>Compiling a Java Package<\/li>\n<li>Executing Java Package Program<\/li>\n<li>Accessing a Java Package<\/li>\n<li>Sub packages in Java<\/li>\n<li>Important Points in Java Package<\/li>\n<li>Dividing Classes into Packages<\/li>\n<\/ol>\n<p>Before starting with Packages in Java it is highly recommended for you to take a quick revision on <em><a href=\"https:\/\/techvidvan.com\/tutorials\/java-interface\/\"><strong>Java Interface<\/strong><\/a><\/em> with Techvidvan.<\/p>\n<h3>Packages in Java<\/h3>\n<p>A package is a collection of similar types of Java entities such as classes, interfaces, subclasses, exceptions, errors, and enums. A package can also contain sub-packages.<\/p>\n<h3>Advantages of using Packages in Java<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/Advantages-of-java-packages.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77258\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/Advantages-of-java-packages.jpg\" alt=\"java package advantages\" width=\"802\" height=\"420\" \/><\/a><\/p>\n<p>There are several advantages of using Java Packages, some of them, are as follows &#8211;<\/p>\n<ul>\n<li>Make easy searching or locating of classes and interfaces.<\/li>\n<li>Avoid naming conflicts. For example, there can be two classes with the name Student in two packages, university.csdept.Student and college.itdept.Student<\/li>\n<li>Implement data encapsulation (or data-hiding).<\/li>\n<li>Provide controlled access: The access specifiers protected and default have access control on package level. A member declared as protected is accessible by classes within the same package and its subclasses. A member without any access specifier that is default specifier is accessible only by classes in the same package.<\/li>\n<li>Reuse the classes contained in the packages of other programs.<\/li>\n<li>Uniquely compare the classes in other packages.<\/li>\n<\/ul>\n<p><em><strong>Get to know about <a href=\"https:\/\/techvidvan.com\/tutorials\/access-modifiers-in-java\/\">Access Specifiers in Java<\/a> you didn&#8217;t know about.<\/strong><\/em><\/p>\n<p>We just put similar classes into the same packages. After that, we simply import the classes from existing packages through the import statement and use them in our program. A package provides access to some classes and others are kept for internal purposes.<\/p>\n<p><strong>Note:<\/strong><\/p>\n<ul>\n<li>Package names are dot-separated, e.g., java.lang.String<\/li>\n<li>Packages avoid namespace collision: A package can not contain two classes with the same names, but two different packages can have a class with the same name.<\/li>\n<li>The exact name of the class is identified by the structure of its package.<\/li>\n<\/ul>\n<h3>Types of Packages in Java<\/h3>\n<p>They can be divided into two categories:<\/p>\n<ol>\n<li>Java API packages or built-in packages and<\/li>\n<li>User-defined packages.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/types-of-packages-in-java.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77256\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/types-of-packages-in-java.jpg\" alt=\"types of java packages\" width=\"600\" height=\"420\" \/><\/a><\/p>\n<h4>1. Java API packages or built-in packages<\/h4>\n<p>Java provides a large number of classes grouped into different packages based on a particular functionality.<\/p>\n<p><strong>Examples:<\/strong><\/p>\n<p><strong>java.lang:<\/strong> It contains classes for primitive types, strings, math functions, threads, and exceptions.<\/p>\n<p><strong>java.util:<\/strong> It contains classes such as vectors, hash tables, dates, Calendars, etc.<\/p>\n<p><strong>java.io:<\/strong> It has stream classes for Input\/Output.<\/p>\n<p><strong>java.awt:<\/strong> Classes for implementing Graphical User Interface &#8211; windows, buttons, menus, etc.<\/p>\n<p><strong>java.net:<\/strong> Classes for networking<\/p>\n<p><strong>java. Applet:<\/strong> Classes for creating and implementing applets<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/Built-in-packages-in-java.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77257\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/Built-in-packages-in-java.jpg\" alt=\"built in package in java\" width=\"958\" height=\"411\" \/><\/a><\/p>\n<h4>2. User-defined packages<\/h4>\n<p>As the name suggests, these packages are defined by the user. We create a directory whose name should be the same as the name of the package. Then we create a class inside the directory.<\/p>\n<h3>Creating a Package in Java<\/h3>\n<p>To create a package, we choose a package name and to include the classes, interfaces, enumerations, etc, inside the package, we write the package with its name at the top of every source file.<\/p>\n<p>There can be only one package statement in each type of file. If we do not write class, interfaces, inside any package, then they will be placed in the current default package.<\/p>\n<h4>Example of Java Package<\/h4>\n<p>We can create a Java class inside a package using a<strong> package<\/strong> keyword.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.packagedemo; \/\/package\nclass Example\n{\n      public static void main(String args[])\n      {\n            System.out.println(\"Welcome to Techvidvan\u2019s Java Tutorial\");\n      }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Welcome to Techvidvan\u2019s Java Tutorial<\/div>\n<h3>How do Packages in Java Work?<\/h3>\n<p>The names of packages and the directory structure are closely related to each other.<\/p>\n<p>For example, if a package name is university.engineering.csedept, then there are three directories- university, engineering, and csedept such that csedept is present in engineering and engineering is present in university.<\/p>\n<p>The package university can be considered as a top-level package while engineering is a subpackage of university and cse dept is a sub-package of engineering.<\/p>\n<h3>Package Naming Conventions<\/h3>\n<p>Packages names follow the reverse order of domain names, that is, org.techvidvan.tutorials. For example, in a university, the recommended convention is university.engineering.mech or university.tech.it or university.arts.history etc.<\/p>\n<p>In the following package:<\/p>\n<p>java.util.Vector<\/p>\n<ul>\n<li><strong>java<\/strong> is a top-level package<\/li>\n<li><strong>util<\/strong> is a sub package<\/li>\n<li>and<strong> Vector<\/strong> is a class which is present in the subpackage util.<\/li>\n<\/ul>\n<h3>Compiling a Java Package<\/h3>\n<p>If you are using an IDE (Integrated Development Environment), then for compiling the package, you need to follow the syntax given below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">javac -d directory javaFileName<\/pre>\n<p><strong>For example,<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">javac -d . Example.java\n<\/pre>\n<p>-d specifies the destination where to locate the generated class file. You can use any directory name like \/home (in case of Linux), C:\/folderName (in case of windows), etc. If you want the package to be present in the same directory, you can use the <strong>dot ( . )<\/strong><\/p>\n<h3>Executing Java Package Program<\/h3>\n<p>You need to use a fully qualified name e.g. com.techvidvan.MyClass etc to run the class.<\/p>\n<p><strong>To Compile:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">javac -d . MyClass.java<\/pre>\n<p>Here<strong> -d<\/strong> represents the destination. The<strong> .<\/strong> represents the current folder.<\/p>\n<p><strong>To run:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">java com.techvidvan.MyClass<\/pre>\n<h3>Accessing Packages or Classes from Another Package<\/h3>\n<p>If we want to access all the classes and interfaces of an existing package then we use the <strong>import<\/strong> statement. We can do it in three different ways:<\/p>\n<ul>\n<li>import package.*;<\/li>\n<li>import package.classname;<\/li>\n<li>fully qualified name.<\/li>\n<\/ul>\n<p>1. By using <strong>*<\/strong> after the import statement, we can access all the classes of the package but not the sub-packages.<\/p>\n<p><strong>Syntax:<\/strong><\/p>\n<p>For importing all the classes:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">import packageName.*;<\/pre>\n<p><strong>Code to illustrate the above concept:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.packagedemo; \/\/package\nclass MyClass\n{\n        public void printName(String name)\n        {\n                System.out.println(name);\n        }\n}<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.packagedemo1;\nimport com.techvidvan.packagedemo.*;\t\t\/\/importing all the classes\n\npublic class MyClass1\n{\n  public static void main(String args[])\n  { \n    \/\/ Initializing the String variable  with a value\n    String name = \"Techvidvan's Java Tutorial\";\n\n    \/\/ Creating an instance of class MyClass from another package.\n    MyClass obj = new MyClass();\n    obj.printName(name);\n\n  }\n}\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Techvidvan&#8217;s Java Tutorial<\/div>\n<p>2. By using a <strong>particular class name<\/strong> after the import statement, we can access that particular class package but not the sub-packages.<\/p>\n<p><strong>Syntax:<\/strong><\/p>\n<p>For importing a particular class:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">import packageName.className;<\/pre>\n<p><strong>Code to illustrate the above concept:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.packagedemo; \/\/package\nclass MyClass\n{\n        public void printName(String name)\n        {\n                System.out.println(name);\n        }\n}\n\npackage com.techvidvan.packagedemo1;\nimport com.techvidvan.packagedemo.MyClass;        \/\/importing a particular class MyClass\n\npublic class MyClass1\n{\n        public static void main(String args[])\n        {\n                \/\/ Initializing the String variable with a value\n                String name = \"Techvidvan's Java Tutorial\";\n\n                \/\/ Creating an instance of class MyClass from another package.\n                MyClass obj = new MyClass();\n                obj.printName(name);\n\n        }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Techvidvan&#8217;s Java Tutorial<\/div>\n<p>3. Using a <strong>Fully qualified name<\/strong> means we can access the declared class of different packages without using the import statement. But you need to use a fully qualified name every time when you are accessing the class or interface which is present in a different package.<\/p>\n<p>This type of technique is generally used when two packages have the same class name example class Date is present in both the packages <strong>java.util<\/strong> and <strong>java.sql<\/strong>.<\/p>\n<p><strong>Code to illustrate the above concept:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.packagedemo; \/\/package\nclass MyClass\n{\n        public void printName(String name)\n        {\n                System.out.println(name);\n        }\n}\n\npackage com.techvidvan.packagedemo1;\npublic class MyClass1\n{\n        public static void main(String args[])\n        {\n                \/\/ Initializing the String variable with a value\n                String name = \"Techvidvan's Java Tutorial\";\n\n        \/\/ Using fully qualified name to access the class of different package\n        com.techvidvan.packagedemo.MyClass obj = new com.techvidvan.packagedemo.MyClass();\n        obj.printName(name);\n\n        }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Techvidvan&#8217;s Java Tutorial<\/div>\n<p><em><strong>Note:<\/strong> If you import a package, you can not import the sub-packages. If you import a package, all the classes and interface of that package will be imported but the classes and interfaces of the sub-packages will not be accessible. Hence, you will have to import the subpackage as well.<\/em><\/p>\n<p><em><strong>Note:<\/strong> The sequence of the program must be package name then import statement.After both the class begins.<\/em><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/Sequence-of-packaging-in-java.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77264\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/Sequence-of-packaging-in-java.jpg\" alt=\"Java Package Sequence\" width=\"512\" height=\"480\" \/><\/a><\/p>\n<h3>Subpackage in Java<\/h3>\n<p>The package present inside a package is called the <strong>subpackage<\/strong>. It is created <strong>to further categorize packages.<\/strong><\/p>\n<p>For example, If we create a package inside the techvidvan package then that will be called subpackage.<\/p>\n<p>Let\u2019s say we have created another package inside techvidvan and the name of subpackage is tutorials. So if we create a class in this subpackage it should have a package declaration in the following manner:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package techvidvan.tutorials.classname;<\/pre>\n<p>Here techvidvan is a package while tutorials is a subpackage of techvidvan.<\/p>\n<p>The standard of defining the package is domain.company.package<br \/>\nexample com.techvidvan.tutorials.javatutorial or org.iit.dao.<\/p>\n<p><strong>Code to explain Subpackage<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.tutorials.javatutorial;\nclass Demo\n{\n       public static void main(String args[])\n       {\n              System.out.println(\"Inside a sub-package\");\n       }\n}<\/pre>\n<p><strong>To compile:<\/strong> javac -d. Demo.java<\/p>\n<p><strong>To run:<\/strong> java com.techvidvan.tutorials.javatutorial<\/p>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Inside a sub-package<\/div>\n<h4>Using Static Import<\/h4>\n<p>&#8216;Static Import&#8217; is a feature introduced in Java programming language for <a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/java\/index.html\">Java<\/a> versions 5 and above that allows fields and members of a class which are declared as public and static to be directly used inside the Java code without specifying the name of the class in which these public static fields or methods are defined.<\/p>\n<p><strong>Code to illustrate the use of static import statement<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/\/ Note static keyword after import.\npackage com.techvidvan.packagedemo;\nimport static java.lang.System.*;\nclass StaticImportDemo\n{\n           public static void main(String args[])\n           {\n                      \/\/ We don't need to use 'System.out'\n                      \/\/ as we imported the package using static.\n                      out.println(\"TechVidvan\");\n           }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Techvidvan<\/div>\n<h3>Important points on Packages in Java<\/h3>\n<ul>\n<li>Every class belongs to a package. If you do not mention any package, the classes in the file move into a special unnamed package which is the same for all the files which do not belong to a specified package.<\/li>\n<li>Multiple classes and interfaces in a file can be part of the same package.<\/li>\n<li>If the package name is specified, then the directory name must match the package name.<\/li>\n<li>We can access the classes declared as public in another package using:<br \/>\nimport package-name.class-name<\/li>\n<\/ul>\n<h3>Dividing Your Classes Into Packages<\/h3>\n<p>You might be thinking that how to categorize your classes into packages. There is no standard method to do this but thee are two methods which you can follow:<\/p>\n<h4>1. Divide by Layer<\/h4>\n<p>This is the first method in which we divide the classes according to the layers of the application. For example, if your application contains a network layer, then you would create a package named network.<\/p>\n<p>All classes which are related to the network of the application are located in the network package.<\/p>\n<h4>2. Divide by Application Functionality<\/h4>\n<p>You can also divide your classes on the basis of what part of the application functionality they belong to. Thus, if your application has a functionality area that calculates interest you would create a Java package named interest.<\/p>\n<p>All classes related directly or indirectly to the interest calculations would go into that package. If the number of classes in the root package becomes very large, they can also be moved to the sub-packages.<\/p>\n<h3>Summary<\/h3>\n<p>Packages are essential for better management and accessing of code. Coming to the end of our tutorial, we learned about the packages in Java in detail along with its two types.<\/p>\n<p>We also covered the working, the techniques to access the packages in other packages in Java, with the help of syntax and coding examples. This will be surely helpful for your further study of the Java language.<\/p>\n<p>Thank you for reading our article. If you have any queries related to Packages in Java, do let us know by dropping a comment below.<\/p>\n<p>Happy Learning \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are folders or directories in our computers for the classification and accessibility of various files, and in Java, we have packages for the same. In Java, Packages are similar to folders, which are&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":77258,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[1952,1953,1954,1955,1956,1957,1958,1959,1960,1961],"class_list":["post-77066","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-compiling-java-packages","tag-creating-java-packages","tag-how-java-package-works","tag-java-package-examples","tag-java-packages","tag-java-packages-advantages","tag-java-packages-types","tag-list-of-packages-in-java","tag-packages-in-java","tag-sub-packages-in-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Packages in Java - Types, Advantages &amp; Techniques to Access Packages - TechVidvan<\/title>\n<meta name=\"description\" content=\"Learn the concept of packages in Java along with its types &amp; explore its working, techniques to access packages in Java, with the help of 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\/packages-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Packages in Java - Types, Advantages &amp; Techniques to Access Packages - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Learn the concept of packages in Java along with its types &amp; explore its working, techniques to access packages in Java, with the help of coding examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/\" \/>\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-03-05T10:29:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-java-packages.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=\"10 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Packages in Java - Types, Advantages &amp; Techniques to Access Packages - TechVidvan","description":"Learn the concept of packages in Java along with its types & explore its working, techniques to access packages in Java, with the help of 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\/packages-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Packages in Java - Types, Advantages &amp; Techniques to Access Packages - TechVidvan","og_description":"Learn the concept of packages in Java along with its types & explore its working, techniques to access packages in Java, with the help of coding examples.","og_url":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-03-05T10:29:22+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-java-packages.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":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Packages in Java &#8211; Types, Advantages &amp; Techniques to Access Packages","datePublished":"2020-03-05T10:29:22+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/"},"wordCount":1758,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-java-packages.jpg","keywords":["Compiling Java Packages","Creating Java Packages","How Java Package works","Java Package Examples","Java Packages","Java Packages Advantages","Java Packages Types","list of Packages in Java","Packages in Java","Sub Packages in Java"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/packages-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/","url":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/","name":"Packages in Java - Types, Advantages &amp; Techniques to Access Packages - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-java-packages.jpg","datePublished":"2020-03-05T10:29:22+00:00","description":"Learn the concept of packages in Java along with its types & explore its working, techniques to access packages in Java, with the help of coding examples.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/packages-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-java-packages.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-java-packages.jpg","width":802,"height":420,"caption":"java package advantages"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/packages-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Packages in Java &#8211; Types, Advantages &amp; Techniques to Access Packages"}]},{"@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\/77066","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=77066"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/77066\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/77258"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=77066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=77066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=77066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}