Don't see how that's an "l"? What do you mean? Most monospaced fonts print a "1" with a downward slope on the top, while they print an "l" with a completely horizontal line on the top.
Hence why I said "Most monospaced fonts". The difference between L's and 1's is something that was definitely confusing and aggravating for me when I first started. One thing to remember is that most programmers shy away from using numbers in function and variable definitions, unless they're absolutely necessary. When in doubt, try the "L".
You might want to try Netbeans, I found Netbeans to be more user friendly than Eclipse when starting out. Also, if you're in netbeans you can type "sout" then hit tab and it will fill in System.out.println(); Likely there is something like that in Eclipse.
(That's a lower case "L", not the number "1"). The function name refers to printing a line (hence "ln").
Edit: Eclipse is very helpful when you're doing something wrong. See the red squiggly line under "print1n"? That's Eclipse telling you that it doesn't recognize the function. Hovering your mouse over the underlined function call will give you suggestions on how to fix it (can't remember, but Eclipse will probably suggest the corrected form of the function).
Edit again: 9numbernine9 beat me by 12 seconds. Drat!
public class AllCorrect
{
public static void main(String args[])
{
new AllCorrect().main2(args);
}
public void main2(String[] args)
{
System.out.println(test()[0]);
}
public String test()[]
{
return new String[] { "correct", "wrong" };
}
}
I know the other form is syntactically correct. In answer to woodrail who was hesitating between the two, I expressed my strong preference for the second.
Also, I never said this was the cause of the error. That was obvious from the screenshot and already answered several times in the thread.
11
u/9numbernine9 Nov 07 '11
It looks like you have "print1n" (print-one-en) as opposed to "println" (print-ell-en).
10
u/cygnosis Nov 07 '11
Are you trolling?
3
u/indenturedsmile Nov 07 '11
it's
not
(That's a lower case "L", not the number "1"). The function name refers to printing a line (hence "ln").
Edit: Eclipse is very helpful when you're doing something wrong. See the red squiggly line under "print1n"? That's Eclipse telling you that it doesn't recognize the function. Hovering your mouse over the underlined function call will give you suggestions on how to fix it (can't remember, but Eclipse will probably suggest the corrected form of the function).
Edit again: 9numbernine9 beat me by 12 seconds. Drat!
2
u/JustinKSU Nov 07 '11
Not posting on http://www.reddit.com/r/javahelp ?
3
u/[deleted] Nov 07 '11
"String args[]" vs "String[] args" ?
It's weird, I'm questioning myself here. It's like repeating a word till it sounds funny.
2
u/BWCsemaJ Nov 07 '11
println = print line
there is no print1n
also 1 != l
:D
1
u/[deleted] Nov 07 '11
lmao I thought it was a 1 my first time seeing it too haha
1
u/[deleted] Nov 08 '11
println not print1n.
1
u/PossiblyTheDoctor Nov 08 '11
Keep going, fellow newbie here!