Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > My first Java app...

My first Java app...
Thread Tools
Senior User
Join Date: Aug 2002
Status: Offline
Reply With Quote
Dec 4, 2002, 06:46 PM
 
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
Reply With Quote
Dec 4, 2002, 07:42 PM
 
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
Reply With Quote
Dec 6, 2002, 06:28 AM
 
When ever you get the message in an error message that says:

cannot resolve symbol
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
Reply With Quote
Dec 7, 2002, 11:03 AM
 
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
Reply With Quote
Dec 9, 2002, 12:47 AM
 
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
Reply With Quote
Dec 9, 2002, 06:31 AM
 
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
Reply With Quote
Dec 9, 2002, 10:08 AM
 
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.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:26 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2