Packages

Views:
 
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Packages:

Packages

INTRODUCTION:

INTRODUCTION ♥ A package is a collection of related classes. ♥ It helps Organize your classes into a folder structure and make it easy to locate and use them. ♥ More importantly,It helps improve re-usability . ♥ In Java, this is achieved by using what is known as “packages”, a concept similar to “class libraries” in other languages.

Introduction (cont.):

Introduction (cont.) ♥ Packages are Java’s way of grouping a number of related classes and/or interfaces together into a single unit. That means, packages act as “containers” for classes. ♥ Syntax :- package < package_name >;

Example.:

Example. package myPack ; public class balance { String name; double bal ; Public balance(string n,double b) { name=n; bal =b; }

PowerPoint Presentation:

Public void show() { system.out.println (“name:-”+ name”balance :-”+ bal ); } }

PowerPoint Presentation:

Import mypack .*; class Testbalance { public static void main (string args [] ) { Balance test = new Balance ( “Raj” , 34500 ); test.show (); } }

END :

END THANK YOU