Saturday 1 December 2012

How to access the particular class of package inside another package

Leave a Comment
Lets Consider a package  package1

import package1;
public class A    //This Class Must Be Public
{
    void display()
   {
      System.out.prinltn("InSide Class A");
   }



Lets Consider another package  package2

import package2;
class B   
{
  public static void main(String args[])
 {
    A obj=new A();
    obj.display();
 }  



Output:
InSide Class A

0 comments:

Post a Comment