Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > using .class file in java

Reply
Thread Tools

using .class file in java

 
 
neha
Guest
Posts: n/a
 
      03-29-2005
i have BankAPIClient.class file and now want to use it in another
program CallBankAPIClient.java by instantiating an object of above
class file. How to do it? guide me.....

Regards,
Neha Gupta
 
Reply With Quote
 
 
 
 
Rhino
Guest
Posts: n/a
 
      03-29-2005

"neha" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> i have BankAPIClient.class file and now want to use it in another
> program CallBankAPIClient.java by instantiating an object of above
> class file. How to do it? guide me.....
>

Add a line like this one to your CallBankAPIClient class:

BankAPIClient myBankAPIClient = new BankAPIClient();

Naturally, you need to pass any arguments required by the BankAPIClient
constructor too. For example:

BankAPIClient myBankAPIClient = new BankAPIClient(customerName,
accountNumber);

Then, to use the methods of the new instance, imitate this:

myBankAPIClient.setPhoneNumber("123-3456");

---
Rhino


 
Reply With Quote
 
 
 
 
Camilla
Guest
Posts: n/a
 
      03-29-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) (neha) wrote in message news:<(E-Mail Removed). com>...
> i have BankAPIClient.class file and now want to use it in another
> program CallBankAPIClient.java by instantiating an object of above
> class file. How to do it? guide me.....
>
> Regards,
> Neha Gupta


Hi! try something like this:

import package.BankAPIClient;

public CallBankApiClient{

// object BankAPIClient
BankAPIClient bap;

public static void main(String[] args){
//initialize object
bap=new BankAPIClient();

//use Object's methods
bap.method();

}
}

you can do this in the main if you're using this as a test class, and
in all of your methods, assuming that BankAPIClass is declared as
public in its package
ciao, Camilla
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hey i am just started java,, can anyone tell me the use ,application, why java , importance of java.. manish sahu Java 3 02-14-2008 12:00 AM
java.io.File.getAbsolutePath() vs. java.io.File.getCanonicalPath() Sathyaish Java 4 03-05-2007 03:55 PM
An Automated process of watching a network file folder, reading a file in it and deleting the file using ASP.NET ? Luis Esteban Valencia Muņoz ASP .Net 3 06-04-2005 10:56 AM
[JAVA] [EVALUATION] - The Java Failure (Sorry: The Java(tm) Failure) Ilias Lazaridis Java 0 02-01-2005 10:32 AM
Job to convert Java App 1.3.1 to Java Newest of Java Michael Kintner Java 0 11-30-2003 04:42 AM



Advertisments