Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26

Thread: basic java

  1. #21
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  2. #22
    vijay24805 is offline Member
    Join Date
    Mar 2009
    Posts
    15
    Rep Power
    0

    Default

    what is the use of defaultwriteobject() in serialization? how does it differ from writeobject() ?

  3. #23
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    Perhaps you could start a new thread for this? Also it may help people decide the best way to respond if you say what you've tried and what you read to figure out the difference.

  4. #24
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Read our FAQ page as well. You must choose the correct place as well. Don't this again, people may encourage to answer your question.

  5. #25
    vijay24805 is offline Member
    Join Date
    Mar 2009
    Posts
    15
    Rep Power
    0

    Default

    class search {



    public static void main(String [] args) {
    String [] sa = {"one", "two", "three", "four"};
    Arrays.sort(sa); // #1
    for(String s : sa)
    System.out.print(s + " ");
    System.out.println("\none = "+ Arrays.binarySearch(sa,"three")); // #2
    System.out.println("now reverse sort");
    ReSortComparator rs = new ReSortComparator(); // #3
    Arrays.sort(sa,rs);
    for(String s : sa)
    System.out.print(s + " ");
    System.out.println("\none = "+ Arrays.binarySearch(sa,"one")); // #4
    System.out.println("one = "
    + Arrays.binarySearch(sa,"one",rs)); // #5
    }

    static class ReSortComparator
    implements Comparator<String> { // #6
    public int compare(String a, String b) {
    return b.compareTo(a); // #7
    }
    }
    }


    in this command the array gets sorted in reverse order after that underlined statement in the code,hows this happen,where did we mention a reverse kind of thing to workon array?

  6. #26
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default

    vijay... your not really too kean to the idea of doing research on your own, are you? If you had looked at the methods that the class Arrays offers, you would have seen that there is ONLY one method that fits the description of the method used in the program.
    If you didn't understnad that, then you could have gone done a google of something like "java arrays sort comparator" and I'm sure you have found plenty of examples.

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Basic Java help, AIM?
    By jkswebsite in forum New To Java
    Replies: 4
    Last Post: 07-11-2012, 07:17 PM
  2. need very basic help with xml parsing in java
    By 2potatocakes in forum New To Java
    Replies: 7
    Last Post: 09-17-2008, 01:22 PM
  3. basic java help
    By adred in forum New To Java
    Replies: 0
    Last Post: 03-08-2008, 01:36 PM
  4. Help with basic shapes in java
    By carl in forum Java 2D
    Replies: 1
    Last Post: 08-01-2007, 12:40 AM
  5. Help, basic shapes using java
    By coco in forum AWT / Swing
    Replies: 1
    Last Post: 07-31-2007, 09:52 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
  •