Executing java inside java example program

Executing java inside java:

MyJava.java

class MyJava{
	
	public static void main(String[] args){
	Javadomain jd = new Javadomain();
	jd.main(null);
}

}

Now we are going to execute this below java program(Javadomain.java) inside the above the java program(MyJava.java),

Javadomain.java:

class Javadomain{
	public static void main(String[] args){
		System.out.println("I am executed successfully, Java inside java success");
	}
}

Output:

I am executed successfully, Java inside java success

Note:
Ensure you have both the above java programs in the same path.

430 total views, 1 views today

About: Mirthbees

Blogger, Innovator, Developer and Enterpreneur. Founder of GuruRecharge, Readymade online recharge script. Lead Developer in Bookrate.in