How to call main method in one class from another class

Suppose i have a code like this

class Demo

{

public static void main(String args[])

{

System.out.println("We are in First class");

}

}

class Demo1

{

public static void main(String args[])

{

System.out.println("We are in second class");

}

}

In the above program how to call main method in demo calss from Demo1 class......?

[420 byte] By [ale_ramesha] at [2007-11-27 0:50:43]
# 1
Do you know how to call not main method from other class?
Michael.Nazarov@sun.coma at 2007-7-11 23:21:03 > top of Java-index,Java Essentials,New To Java...
# 2
there isn't anything mystical or special about the main method, it merely adheres to a specific method signature. You can call it the same way that you would call a method on any class from another class (Class.main(String[] args)).
cjmosea at 2007-7-11 23:21:03 > top of Java-index,Java Essentials,New To Java...
# 3
No, i dont know how to call other than main methods from other classes And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add
ale_ramesha at 2007-7-11 23:21:03 > top of Java-index,Java Essentials,New To Java...
# 4
> Class.main(String[] args)Hmm, there is no such method! :( http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html
Michael.Nazarov@sun.coma at 2007-7-11 23:21:03 > top of Java-index,Java Essentials,New To Java...
# 5
You need to read book for beginners and install some kind of development software. For example.... Yes, NetBeans :)
Michael.Nazarov@sun.coma at 2007-7-11 23:21:03 > top of Java-index,Java Essentials,New To Java...
# 6
cheeky ;-)Class was not referring to java.lang.Class but rather to "any class". I stand corrected and should have used something more clearly fictitious as an example, YourClass or some such nonsense.
cjmosea at 2007-7-11 23:21:03 > top of Java-index,Java Essentials,New To Java...
# 7
> YourClass or some such nonsense.How about Demo1? :))Anyway OP should read book not answers for such... hmm, ok, just such questions.
Michael.Nazarov@sun.coma at 2007-7-11 23:21:03 > top of Java-index,Java Essentials,New To Java...