This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

printing numbers????  RSS feed

 
raymond yadao
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there an easy way to program a program that accept 10 numbers and prints it from highest to lowest using the collection classes?
i know treeset has a sorting mechanism that prints its elements from lowest to highest...
thanks....
raymond
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes there is an easy way to do this. You might take advantage of one of the Collections.sort() methods or one of the Arrays.sort() methods. Take a look at The Java 2 API Documentation to figure out what might work best for your problem.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!