Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-12-2007, 11:56 AM
Member
 
Join Date: Dec 2007
Posts: 2
Igor is on a distinguished road
repetition of 'arguments'(?)
Hi all,

I'm really new to java and have a heap of code that I'm now trying to get acquinted with. Don't know if this is the right place to post this question, but here it is:

System.out.println("User " + ret.name + ret.place);
Which is a line of the code. Not important right now what it does or why, but suppose I want to allow the program to retrieve (which I say "ret." means right?) possibly more than one name/place for a user.
Eclipse (which I'm working in) doesn't really seem to like:
System.out.println("User " + ret.name* + ret.place*);

Can anyone tell me if there is a possibily to do this the above way (and that it's just some incorrect syntax), or that something like that won't work at all and I'll have to find a solution somewhere else in the program.

thanks,
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-12-2007, 02:51 PM
ShoeNinja's Avatar
Senior Member
 
Join Date: Oct 2007
Posts: 123
ShoeNinja is on a distinguished road
Send a message via AIM to ShoeNinja
No it's not possible to do it that way. It's much more than bad syntax.

In your code, ret is an object (instance of a class). It represents a single instance. The .name and the .place are methods in whatever class to which ret belongs.

It sounds like you need to do some reading on the idea of classes, objects and methods before you try to start learning too much more code.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-13-2007, 07:29 AM
Member
 
Join Date: Dec 2007
Posts: 26
apfroggy0408 is on a distinguished road
If I'm thinking what you're trying to do correctly is you typing in the information and it showing up?

If so, set it up where you have those two variables set up to be the input of whatever the keyboard puts.

You'll have to be familiar with the Scanner class.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-13-2007, 11:08 AM
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
Quote:
Eclipse (which I'm working in) doesn't really seem to like:
System.out.println("User " + ret.name* + ret.place*);
Yeah, eclipse wont like this because you have a * in the declaration name.

Three notes:
First of all, its not Eclipse the doesnt like it, its java that doesnt like it. Learn to separate the two.
Second. FOR GODS SAKE? Why are you using an IDE? If you know as little java as you seem to, you should not even be touching eclipse for the next few months. You are missing very important concepts.
Third. Its nice when you define what "it doesnt like this" means... i have never had an error "Line 34: i dont like this".
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arguments in Main CyberFrog New To Java 2 03-30-2008 10:37 PM
Finding arguments of Servlet Java Tip Java Tips 0 01-25-2008 08:04 PM
Printing command line arguments Java Tip Java Tips 0 12-03-2007 10:27 AM
Variable No. of Arguments Gajesh Tripathi New To Java 2 10-31-2007 03:50 PM
Java Command Line Arguments In Eclipse IDE JavaForums Eclipse 0 05-19-2007 10:45 AM


All times are GMT +3. The time now is 04:26 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org