hello friends. i would like to know if it is possible to run a class file using a java program itself.i mean a program tht would return the answer (run) the class file .

Recommended Answers

All 4 Replies

It is possible but pointless. If you want to call the class program to get the answer, then just put what is inside the main to a separate method with arguments and call that method.

It is possible but pointless. If you want to call the class program to get the answer, then just put what is inside the main to a separate method with arguments and call that method.

actually this is a part of dynamically changing class.
i dont want to use a method .i want the class itself to be executed and return the result.If u show me through an example it would be of great help

thanks guys for ur help .i have found the solution myself n using the runtime class

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.