Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Calling other java classes from one java class

Posted on 2005-03-23
Medium Priority
Last Modified: 2010-04-17
  I have total 8 java classes...(Ex:all plain java classes,all have the main methods.each one of
these doing database operations independently).
in those, from one java class i want to call all remaining 7 java classes.
I would like to get the total functionality just by running 1 java class.
 how can i do this?

Question by:raammohan
LVL 10

Accepted Solution

makerp earned 500 total points
ID: 13611305
remove main from the other 7 classes and then have the remaining class with the main method create an instance of the other classes and use them, for exmaple

class class_1{
  void doIt(){

class class_2{
  void doIt(){

class class_3{
       class_1 one = new class_1();

       class_2 two= new class_2();
LVL 25

Expert Comment

ID: 13612300
makerp is correct.

I suggest that you look into using "Packages" with Java; and inheritance. It will come in useful.
You will be able to find some tutorials on there at the home of Java: http://java.sun.com/

Good luck,
>> IM

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question