Simple example on Package Java Program

What is Package in Java Program?

– In Simple word, package are folder or directory.

What is use of packages in Java Program?

– When we want to store our classes in proper folder that time we need packages.

Example:

I give simple project details with packages storage.

Project: College Management

Student Packages

– Store all Student related classes here

Faculty Packages

– Store all Faculty related classes here

Admin Packages

– Store all admin related classes here

 This structure or customization helps programmer to manage all project.

 

Example on Packages.

package pack1; //            set path of packages

class example1

{

public static void main(String args[])

{

System.out.println(“Welcome in Packages Examples”);

}

}

How to compile this program in command prompt

Javac pack1/example1.java

How to run this program in command prompt

Java pack1.example1

 

Output:

Welcome in Packages Examples

 

Video available on YouTube.


[sbscrbr_form]

If you have any query on blog example, you can directly comment us or subscribe our website


Earn Money Online

1256total visits,4visits today


mayank

Hello, I am Maddy a Java blogger, trainer and developer

Related articles

1 Comment

  1. October 22, 2016 - 10:25 am

    I see your blog needs some unique articles. Writing manually is time consuming, but there is tool for
    this task. Just search for; Fasrixo’s tools

Leave a Reply

Your email address will not be published. Required fields are marked *

Your comments (*)

Name (*)

Your full name please.

Email address (*)

Used for gravatar.

Website

Link back if you want.

Enter Captcha Here :*

Reload Image