It's not a secret anymore!*
The moose likes Beginning Java and the fly likes Simple java error need some advice please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Simple java error need some advice please" Watch "Simple java error need some advice please" New topic
Author

Simple java error need some advice please

andy yup
Greenhorn

Joined: Nov 19, 2009
Posts: 1
this might be very basic, but literally today is my first day trying to learn java.

ok here is my code.


I have no idea what I did wrong, its probley really basic cause im java stupid.
but im getting this error.
(filename/directory) <identifier> expected
Public static void main (args[]) {

Then theres a little carrot(^) underneath the 2nd parenthese in (args[])
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
public static void main (args[])


When passing argument it should know the argument type.

in your case the argument to the main method should be String array.

So it should be like this



SCJP 6,SCWCD 5,SCBCD 5

Failure is not an option.
Al Fraelich
Greenhorn

Joined: May 25, 2009
Posts: 20
Shouldn't the string be the arryay like this

public static void main(String[] args)

I could be wrong, but that's the way I have always done it, but i'm learning too.
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
Both are same but your's is more clean and clear and recommended

But again both are valid.
 
 
subject: Simple java error need some advice please
 
Similar Threads
How to create a static class
main without string args[ ]
String[] args
Is an object created at this point
problem in compiling my java application using Mac Os X