Results 1 to 2 of 2
  1. #1
    KMS is offline Member
    Join Date
    Sep 2008
    Rep Power

    Red face How to compare Built_versions???

    A client application needs to determine if the server to which it is connecting is compatible.

    The server will inform the client which versions it supports, for instance responding with a min_version="5.0.1_1" and a max_version="5.0.10_1".

    The client application needs to compare these versions with its own build version, for instance build_version="5.2.6_5" would be compatible.

    Please produce client code using Java that will indicate to the user whether the client is:
    a) compatible with the server
    b) older than the minimum supported version
    c) newer than the maximum supported version

    How can we compare the build_version, which is a string???
    How can we separate the numbers and compare the versions???

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Colombo, Sri Lanka
    Blog Entries
    Rep Power


    In such a case what I have done is the client version records in a config file. Actually in each client should have a configuration file. Because we have to make certain changes time to time.

    Then if you want to test those versions on server and client, simply get them as strings and compare. You can use equals() for that.

Similar Threads

  1. How to Compare two Dates
    By Java Tip in forum java.util
    Replies: 1
    Last Post: 06-24-2008, 08:05 AM
  2. Compare 5 numbers
    By Snowboardmylife in forum New To Java
    Replies: 5
    Last Post: 04-15-2008, 08:04 PM
  3. Compare lists
    By JavaNoob in forum New To Java
    Replies: 2
    Last Post: 08-08-2007, 04:11 PM
  4. Compare 2 XML
    By Peter in forum XML
    Replies: 1
    Last Post: 07-05-2007, 03:58 AM
  5. compare speed
    By bbq in forum JDBC
    Replies: 1
    Last Post: 06-28-2007, 06:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts