File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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:-

1) p1.java

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

2) p2.java

class p3
{
// strange!! execute this file we will get output of p1.java
}
class p4
{

}



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

Joined: Oct 15, 2011
Posts: 249

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: http://aspose.com/file-tools
 
subject: Getting output of other class.