![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Explain naming conventions for packages 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 −
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.
Advertisements