Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: New at Java

  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    New at Java

    I have been trying to learn java coding from a book and have run into a coding question that I'm confused about. Can someone help?
    I have a one dimensional array of positive integers. I'm trying to create another array with the same length and scan the original array for finding the maximum integer. I am then needing to copy that maximum integer in first position of the created array and set the maximum integer in the original array to zero. For second round, I need to write code to find the maximum integer in the original array and copy that in second position of created array and set the maximum integer in the original array to zero. I need to repeat this until all numbers in original array is zero. My created array should be sorted in positive integer numbers. I need to write this sort method that accepts a one dimensional array of integers that return the sorted array testing this method using the main method.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,080
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    This is the JavaScript forum. Java and Javascript are entirely different programming languages, in spite of the confusingly similar names. Rather like Austria and Australia!
    Last edited by Philip M; 07-22-2011 at 06:52 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by Bighairjersey View Post
    I have been trying to learn java coding from a book and have run into a coding question that I'm confused about. Can someone help?
    I have a one dimensional array of positive integers. I'm trying to create another array with the same length and scan the original array for finding the maximum integer. I am then needing to copy that maximum integer in first position of the created array and set the maximum integer in the original array to zero. For second round, I need to write code to find the maximum integer in the original array and copy that in second position of created array and set the maximum integer in the original array to zero. I need to repeat this until all numbers in original array is zero. My created array should be sorted in positive integer numbers. I need to write this sort method that accepts a one dimensional array of integers that return the sorted array testing this method using the main method.
    What you want to do can be done in both javascript and java. Although some of the syntax is similar for both, they are essentially different programming languages with java generally being much more powerful.

    Do you want to do this with java or javascript since you posted in the javascript forum?


  •  

    Posting Permissions

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