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
doubt in main()
doubt in main()
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
ramya kandasamy
New Member
Join Date:
Apr 2010
Posts:
9
#1
doubt in main()
Apr 29 '10, 11:58 AM
can we write main ( ) without static keyword.if yes tell me the way.Because i am getting run time exception.
jkmyoung
Recognized Expert
Top Contributor
Join Date:
Mar 2006
Posts:
2057
#2
Apr 29 '10, 02:25 PM
You can, but then main will just be a member function and can't be used to enter the program.
What is your runtime exception?
Comment
Post
Cancel
jkmyoung
Recognized Expert
Top Contributor
Join Date:
Mar 2006
Posts:
2057
#3
Apr 30 '10, 01:53 PM
"ramya kandasamy
i am geetiing run time exception like below :
exception in thread "main" java.lang.no such method error:main
"
Can we see your main method declaration? Is it public?
Comment
Post
Cancel
Dheeraj Joshi
Recognized Expert
Top Contributor
Join Date:
Jul 2009
Posts:
1129
#4
May 1 '10, 08:44 AM
You can write a main function without static, but in your class you must have a public static main class for entering into the program.
For entering to a program you need a main, it must be public and static.
Regards
Dheeraj Joshi
Comment
Post
Cancel
Previous
template
Next
Working...
OK
OK
Cancel
👍
👎
☕
Comment