- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do I write package names in Java?
While choosing a package name you need to keep the following points in mind.
- The name of the package should be in small letters.
- It is suggested to start the name of the package with the top level domain level followed by sub domains, ex: com.example.tutorialspoint.
Example
You can declare a package as in.
package com.mypackage.tutorialspoint; Public class Sample { Public static void main(String args[]) { System.out.println("Welcome to Tutorialspoint"); } }
Executing a package
You need to compile the file with packages using –d option as:
C:\Sample>javac -d . PackageExample.java
After compiling, you can see the class files of the class created in the location com/mypackage/tutorialspoint.

- Related Articles
- How do I write class names in Java?
- How do I write method names in Java?
- How do I write variable names in Java?
- How do I write constructor names in Java?
- How do I write interface names in Java?
- How do I write constants names in Java?
- How do I create a namespace package in Python?
- How do I search for names starting with A in MySQL?
- How do I import all the submodules of a Python namespace package?
- How to access Java package from another package
- How do I create dynamic variable names inside a JavaScript loop?
- How do I compare strings in Java?
- How do I read (or write) binary data in Python?
- How to use sub-package in Java?
- How do I empty a list in Java?

Advertisements