Sunday, 4 December 2016

Java - Packages

Package
i) Syntax to create a package:-
package <pkgname>;
        pkgname should be same as current directory and this statement should be written at very first line of the program.
        Then we may import required packages and define classes and interfaces as required.
        Then compile them.
       



ii) Using user-defined pkg in a pgm:-
        import required user-def pkg.
        then use corresponding classes in our program.
        Before we compile this program, we have to set classpath as following method:-

set classpath=%classpath%;path of pkg;.;

No comments:

Post a Comment

Featured post

Development Of JAVA Program