|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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, |
| Sponsored Links |
|
|
|
|||
|
In addition:
This name and place calls to some dictionary where names and places are alternating (and, of course, are supposed to match). So something like "name:John, place:New York, name:Richard, place:New Delhi, name:Little, name:George, place aris" and so on. Problem is that as you see some people have double names. So something like System.out.println("User " + ret.name + ret.name + place); just results in John John New York. I want the program to keep n taking names until it bumps into a place. |
|
|||||
|
It might be incorrect syntax, but without knowing how the ret class is setup, it would be impossible to tell. In eclipse, if you put your cursor on ret.name and I believe, press Ctrl+1 it shows you possible fixes.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |