Results 1 to 9 of 9
- 11-21-2012, 05:54 PM #1
Member
- Join Date
- Nov 2012
- Posts
- 11
- Rep Power
- 0
Help me I get this error: Error: Main method not found in class Position
Hi there I am totally new to Java, and I have tried to create this very simple class:
Where I have a postion and then I want to be able to get the column and row of that position...
Java Code:public class Position { private int column; private int row; public Position() { column = 4; row = 3; } public int getColumn() { return column; } public int getRow() { return row; } }
Error: Main method not found in class Position, please define the main method as: public static void main(String[] args)
I have pretty much copied an example from my textbook so I am not really sure why I get this error, so could you please help me out?
- 11-21-2012, 06:01 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Re: Help me I get this error: Error: Main method not found in class Position
The JVM can't find a main( ... ) method in that class (and neither can I); the JVM needs that method to start the entire show. I you copied that class from somewhere, that class wasn't meant to be used as a starting point of a program.
kind regards,
JosBuild a wall around Donald Trump; I'll pay for it.
- 11-21-2012, 07:15 PM #3
Member
- Join Date
- Nov 2012
- Posts
- 11
- Rep Power
- 0
Re: Help me I get this error: Error: Main method not found in class Position
Ok but then you can create a Main class that calls these other classes and thereby brings them to use, right?
(I have to write more than one class)
And could you perhaps give me a tip on that would look?
-
Re: Help me I get this error: Error: Main method not found in class Position
Even better than a tip, we'll give you an entire tutorial: The Really Big Index
- 11-22-2012, 02:26 AM #5
- 11-22-2012, 02:27 AM #6
Senior Member
- Join Date
- Nov 2012
- Posts
- 105
- Rep Power
- 0
Re: Help me I get this error: Error: Main method not found in class Position
But I'm still a noob too, and If I don't it won't compile (╯°□°)╯︵ ┻━┻
- 11-22-2012, 02:32 AM #7
Re: Help me I get this error: Error: Main method not found in class Position
Then perhaps you should gain a better understanding of what static means before offering bad advice.
-
Re: Help me I get this error: Error: Main method not found in class Position
I have to agree with Junky, and in fact since your advice is potentially misleading to a newbie, I've deleted your post (and will delete this post as well). Let's stick to giving advice on things we're familiar with.
- 11-22-2012, 08:16 AM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Similar Threads
-
main method not found error in class . wat s the error?
By kirankumaragnihotram in forum New To JavaReplies: 10Last Post: 06-29-2012, 12:26 PM -
Main Method not found in class
By HinaKhan in forum New To JavaReplies: 6Last Post: 06-22-2012, 03:34 PM -
<No main classes found> Error
By hersman in forum NetBeansReplies: 2Last Post: 04-23-2011, 02:08 AM -
main method not found in class
By eLancaster in forum New To JavaReplies: 5Last Post: 02-09-2011, 09:48 AM -
No main class found error
By jhering1986 in forum New To JavaReplies: 17Last Post: 03-28-2009, 03:34 AM
Bookmarks