Implementing Package in Java
April 29, 2017
Categorised in: Java Core
What is a package?
- A package is a namespace concept which organizes a set of related interfaces and classes.
- It can be thought of as different folders on your system.
Implementing Package
package com.pratikkataria.java; public class Main { public static void main( String[] args) { System.out.println(args[0]); } }
- This Main.java file needs to be kept inside folders:
- com -> pratikkataria -> java -> Main.java
- So the command prompt needs to be started in the location where the com folder is:
- K:\>
- CONSOLE:
- K:\>javac com\pratikkataria\java\Main.java
- K:\>java com.pratikkataria.java.Main MyArg
- OUTPUT:
- MyArg
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.