File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Getting output of other class. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Getting output of other class." Watch "Getting output of other class." New topic

Getting output of other class.

rohit shekhar
Ranch Hand

Joined: Mar 05, 2010
Posts: 32
I was trying this...
In a common package (in eclipse) i placed two files as follows:-


public class p1 {
public static void main(String[] args)
p2 p = new p2();
class p2
void disp()
System.out.println("From class p2");


class p3
// strange!! execute this file we will get output of
class p4


if we will execute it shows output of
please explain.
Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 250

you might be using this command for execution-
java p2

Astha - OCPJP 6 (90%)
naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384

if you can please provide complete code with command line options
I agree. Here's the link:
subject: Getting output of other class.
It's not a secret anymore!