Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to return multiple values in java?

 
Mohan Mehra
Ranch Hand
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this the output i'm getting :



.1.3.6.1.2.1.1.1.0: Windows samartha-81d5a0 5.1.2600 Service Pack 3 XP Professional x86 Family 15 Model 4 Stepping 9
.1.3.6.1.2.1.1.2.0: .iso.org.dod.internet.private.enterprises.8072.3.2.13
.1.3.6.1.2.1.1.3.0: 8 hours, 8 minutes, 33 seconds.
.1.3.6.1.2.1.1.4.0: raj
.1.3.6.1.2.1.1.5.0: samartha-81d5a0
.1.3.6.1.2.1.1.6.0: unknown
.1.3.6.1.2.1.1.7.0: 0
.1.3.6.1.2.1.1.8.0: 0 hours, 0 minutes, 0 seconds.
.1.3.6.1.2.1.1.9.1.2.1: .1.3.6.1.2.1.31
.1.3.6.1.2.1.1.9.1.2.2: .1.3.6.1.2.1.49
.1.3.6.1.2.1.1.9.1.2.3: .1.3.6.1.2.1.4
.1.3.6.1.2.1.1.9.1.2.4: .1.3.6.1.2.1.50
.1.3.6.1.2.1.1.9.1.2.5: .1.3.6.1.6.3.1
.1.3.6.1.2.1.1.9.1.2.6: .1.3.6.1.6.3.16.2.2.1
.1.3.6.1.2.1.1.9.1.2.7: .1.3.6.1.6.3.10.3.1.1
.1.3.6.1.2.1.1.9.1.2.8: .1.3.6.1.6.3.11.3.1.1
.1.3.6.1.2.1.1.9.1.2.9: .1.3.6.1.6.3.15.2.1.1
.1.3.6.1.2.1.1.9.1.2.10: .1.3.6.1.6.3.13.3.1.3
.1.3.6.1.2.1.1.9.1.3.1: The MIB module to describe generic objects for network interface sub-layers
.1.3.6.1.2.1.1.9.1.3.2: The MIB module for managing TCP implementations
.1.3.6.1.2.1.1.9.1.3.3: The MIB module for managing IP and ICMP implementations
.1.3.6.1.2.1.1.9.1.3.4: The MIB module for managing UDP implementations
.1.3.6.1.2.1.1.9.1.3.5: The MIB module for SNMPv2 entities
.1.3.6.1.2.1.1.9.1.3.6: View-based Access Control Model for SNMP.
.1.3.6.1.2.1.1.9.1.3.7: The SNMP Management Architecture MIB.
.1.3.6.1.2.1.1.9.1.3.8: The MIB for Message Processing and Dispatching.
.1.3.6.1.2.1.1.9.1.3.9: The management information definitions for the SNMP User-based Security Model.
.1.3.6.1.2.1.1.9.1.3.10: The MIB modules for managing SNMP Notification, plus filtering.
.1.3.6.1.2.1.1.9.1.4.1: 0 hours, 0 minutes, 0 seconds.
.1.3.6.1.2.1.1.9.1.4.2: 0 hours, 0 minutes, 0 seconds.
.1.3.6.1.2.1.1.9.1.4.3: 0 hours, 0 minutes, 0 seconds.
.1.3.6.1.2.1.1.9.1.4.4: 0 hours, 0 minutes, 0 seconds.
.1.3.6.1.2.1.1.9.1.4.5: 0 hours, 0 minutes, 0 seconds.
.1.3.6.1.2.1.1.9.1.4.6: 0 hours, 0 minutes, 0 seconds.
.1.3.6.1.2.1.1.9.1.4.7: 0 hours, 0 minutes, 0 seconds.
.1.3.6.1.2.1.1.9.1.4.8: 0 hours, 0 minutes, 0 seconds.
.1.3.6.1.2.1.1.9.1.4.9: 0 hours, 0 minutes, 0 seconds.
.1.3.6.1.2.1.1.9.1.4.10: 0 hours, 0 minutes, 0 seconds.





this value i have to return it to another class which will print it. i took the result in result[i] and put it into val of string type. but its printing only the last value i.e., :
0 hours, 0 minutes, 0 seconds.


how to fix it?

i'm getting values from the database and putting it in a class. from this class i need to return to another class. but its returning only last value
 
Joanne Neal
Rancher
Pie
Posts: 3742
16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohan Mehra wrote:put it into val of string type. but its printing only the last value

So you've put it into the String wrong, but without seeing your code, nobody can tell you what the problem is.
 
John Jai
Rancher
Posts: 1776
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i took the result in result[i] and put it into val of string type. but its printing only the last value i.e., :

Probably you are overwriting only on the result[0] or not iterating the array in a right way. Posting the code might get you better help.

You can however try using List<String> instead of String[].
 
Mohan Mehra
Ranch Hand
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got it. used arraylist
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic