//i have written this code in package p1::
//address of this file is:::C:\p1

package p1;
public class balance{
String name;
double bal;
public balance(String n,double b)
{
name=n;
bal=b;
}
}


//and now i want to import this file in this code
//address of this file is:::C:\Program Files\Java\jdk1.6.0_11\bin
import p1.*;

class testbal
{
public static void main(String args[]){
balance test=new balance("ahmed",99.88);
}
}


plz tell how to execute this imported package file in cmd.

you'll need to place the package p1 somewhere the compiler of the second application can find it.
also, you might want to put a print-instruction in the balance constructor or at the end of the main method, just to check whether or not the program does what you intend it to do.

you should specify the supporting class file location to the current class..

suppose your class1 in folder exam/doit/

then you want add class1 to the current class class2..

then your class2 package declaration like this..

import exam.dot.*;

or

import exam.dot.class1;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.