 |
 |
My first Java app...
|
 |
|
 |
|
Senior User
Join Date: Aug 2002
Status:
Offline
|
|
I'm taking Java for a spin, and have ran into a problem with my first app. Here's the code...
class Displayer
{
public static void main(String args[])
{
System.out.printIn( "Hello world!" );
}
}
This is the error JJEdit is giving...
First App.java:5: cannot resolve symbol
symbol : method printIn (java.lang.String)
location: class java.io.PrintStream
System.out.printIn( "You'll love Java!!!" );
^
1 error
So what's the problem? Any ideas?
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Nov 2002
Status:
Offline
|
|
Originally posted by NeXTLoop:
I'm taking Java for a spin, and have ran into a problem with my first app. Here's the code...
class Displayer
{
public static void main(String args[])
{
System.out.printIn( "Hello world!" );
}
}
This is the error JJEdit is giving...
First App.java:5: cannot resolve symbol
symbol : method printIn (java.lang.String)
location: class java.io.PrintStream
System.out.printIn( "You'll love Java!!!" );
^
1 error
So what's the problem? Any ideas?
It's println as in "printLn"
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Nov 2002
Location: Sydney Australia
Status:
Offline
|
|
When ever you get the message in an error message that says:
It usually means that you have miss spelled a method or class/object name incorrectly.
Also try to use a more standard Java formating like this.
class Displayer {
public static void main(String args[]) {
System.out.println( "Hello world!" );
}
}
See the Java Sun site for details. It just helps you and other Java programmers read your code.
Best luck - Coding 
(Last edited by mrburri; Dec 6, 2002 at 06:47 AM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status:
Offline
|
|
actually, it's none of the above...
the problem is with the arguments that you're passing to main().
it should be:
public static void main(String[] args) {...}
...it's "String[]" meaning that you're passing an array of Strings called "args"...
that should fix you're problem.
-amit
ps it's "System.out.println" not "printLn"
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status:
Offline
|
|
Noooo.... You can use String args[] also, it is equivalent in Java.
The problem is that he's calling System.out.printIn, with a capital i instead of a lower case L... I used to have these problems with javadocs too, they use a font that doesn't differentiate between uppercase i and lowercase L very easily...
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Feb 2002
Location: Atlanta
Status:
Offline
|
|
Originally posted by itai195:
Noooo.... You can use String args[] also, it is equivalent in Java.
The problem is that he's calling System.out.printIn, with a capital i instead of a lower case L... I used to have these problems with javadocs too, they use a font that doesn't differentiate between uppercase i and lowercase L very easily...
By George, you're right! I looked at this for awhile without seeing it. I was starting to think my Java skills were pretty weak.
#gheff
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
Originally posted by gheff:
By George, you're right! I looked at this for awhile without seeing it. I was starting to think my Java skills were pretty weak.
#gheff
Apparently they are - whenever the compiler complains about a method or constructor or class name not found that should clue you in that that is the problem. Now if you have a syntax error, those can be pretty hard to find since the compiler will start spewing out all kinds of weird errors.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|