Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Java only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Member List
Calendar
Today's Posts
Home
Forum
Topic
Java
can we call main method from another main method
can we call main method from another main method
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
mahi543
New Member
Join Date:
Aug 2007
Posts:
5
#1
can we call main method from another main method
Sep 5 '07, 10:54 AM
how can we call one class main method from another class main method?
i tried but i got an idea for method we can call one method from another method
madhoriya22
Contributor
Join Date:
Jul 2007
Posts:
251
#2
Sep 5 '07, 11:39 AM
Originally posted by
mahi543
how can we call one class main method from another class main method?
Hi,
Plz make urself more clear. Why do you need that?
i tried but i got an idea for method we can call one method from another method
What do you mean by that line?
Comment
Post
Cancel
misaw
New Member
Join Date:
Aug 2007
Posts:
17
#3
Sep 5 '07, 11:45 AM
Originally posted by
mahi543
how can we call one class main method from another class main method?
i tried but i got an idea for method we can call one method from another method
Try this ...
[code=java]
ClassB {
public static void main(String[] args) {
System.out.prin tln("ClassB main() Called");
}
}
ClassA {
public static void main(String[] args) {
System.out.prin tln("ClassA main() Called");
ClassB.main(arg s);
}
}
[/code]
ouput
ClassA main() Called
ClassB main() Called
static methods are called without instantiating the object of class containing the method.
Comment
Post
Cancel
Previous
template
Next
Working...
OK
OK
Cancel
👍
👎
☕
Comment