Goseeko blog
  • Home
  • Engineering
    • Civil
    • Electronics
    • Computers
  • Science
    • Chemistry
    • Maths
    • Physics
  • Commerce
  • Arts
  • E-Learning
  • Career
  • Exams
  • Scholarships
  • Hiring News
  • Goseeko- Smart Study Material
@2021 - All Right Reserved. Designed and Developed by PenciDesign
Top Posts
Goseeko launches its own certifications for engineering and...
Online certifications which you can get in a...
What is Race around Condition?
What is a Development Plan ?
What is a Co-operative Bank?
What are the properties of Laser?
Top 5 Websites for Academic Research
What is regula-falsi method?
Top 10 Engineering YouTube Channels for Engineers
What is Lorentz Transformation?
What are Toposheets?
What is Pumping and its types?
Computers

What is a Packages?

by Bhumika 19/01/2022
written by Bhumika 19/01/2022 0 comment

In Java, packages are uses to avoid naming conflicts, limit access, and make searching/locating and using classes, interfaces, enumerations, and annotations easier, among other things.

In addition, A Package is a collection of linked types (classes, interfaces, enumerations, and annotations) that provides namespace management and access control.

On the other hand, A Java package is a logical grouping of related classes, interfaces, and sub-packages. Built-in packages and user-defined packages are the two types of packages in Java.

For instance, Java, lang, awt, javax, swing, net, io, util, sql, and other built-in packages are available.

Some of the Java packages that are currently available are:

java.lang – Contains all of the core courses.

java.io – This package includes classes for input and output functions.

Programmers can create their own packages to gather together classes, interfaces, and other items. Furthermore,It’s a good idea to group related classes that you’ve implementing so that a programmer can quickly see how the classes, interfaces, enumerations, and annotations are connect.

Advantages

1) Firstly, The Java package is uses to organize the classes and interfaces in order to make them easier to maintain.

2) Secondly,Access control is provided via the Java package.

3) Lastly, The Java package eliminates naming conflicts.

Creating a package

In addition, When building a package, give it a name and include a package statement at the head of every source file that contains the classes, interfaces, enumerations, and annotation types that you want to include in the package.

Most importantly, the first line of the source file should contain the package statement. Each source file can only have one package statement that applies to all types in the file.

The class, interfaces, enumerations, and annotation types will placed in the current default package if no package statement is specified.

You must use the -d option to compile Java programmes with package statements, as illustrated below.

javac -d Destination_folder file_name.java

Moreover, the compiled class files will then, stores in a folder with the supplied package name in the requested destination.

Interested in learning about similar topics? Here are a few hand-picked blogs for you!

  1. What is JDBC connectivity?
  2. Describe programming?
  3. What is object oriented programming?
  4. Explain Recursion?
Share
0
FacebookTwitterPinterestLinkedinTumblr
previous post
CBSE Class 12 Term 1 English Core Paper Answer Key 2021 Released
next post
What is the PLI scheme?

You may also like

What is the difference between Overloading and Overriding?

05/05/2022

What is the Line Drawing Algorithm in computer...

05/05/2022

What is the purpose of the Database System?

05/05/2022

What is the difference between system software and...

25/04/2022

What is the difference between Html and Html5?

25/04/2022

What is the Abstract data type in Data...

25/04/2022

What are the Characteristics of an Algorithm?

25/04/2022

What is Java Virtual Machine?

25/04/2022

What are the Advantages of LAN?

25/04/2022

What is the Leaky Bucket Algorithm?

20/04/2022

Leave a Comment Cancel Reply

Save my name, email, and website in this browser for the next time I comment.

Keep in touch

Facebook Twitter Instagram Youtube

Popular Posts

  • 1

    What is Race around Condition?

    03/08/2021
  • 2

    What is a Development Plan ?

    02/08/2021
  • 3

    What is a Co-operative Bank?

    03/08/2021
  • 4

    What are the properties of Laser?

    02/07/2021
  • 5

    Top 5 Websites for Academic Research

    11/07/2021
  • 6

    What is regula-falsi method?

    03/08/2021
  • 7

    Top 10 Engineering YouTube Channels for Engineers

    10/07/2021
  • 8

    What is Lorentz Transformation?

    02/07/2021
  • 9

    What are Toposheets?

    07/07/2021
  • 10

    What is Pumping and its types?

    03/08/2021

Categories

  • Arts
  • Career
  • Chemistry
  • Civil
  • Commerce
  • Computers
  • E-Learning
  • Electronics
  • Engineering
  • Exams
  • Hiring News
  • Maths
  • Physics
  • Scholarships
  • Uncategorized

Read alsox

What are the Benefits and Drawbacks...

20/04/2022

What is a DBMS?

06/07/2021

What is a Computer Processor?

06/05/2021