Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: how array works ?

  1. #1
    Banned
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default how array works ?

    import java.util.*;
     
    public class  array{
      public static void main(String[] args){
      int num[] = {50,20,45,82,25,63};
      int l = num.length;
      int i,j,t;
      System.out.print("Given number : ");
      for (i = 0;i < l;i++ ){
      System.out.print("  " + num[i]);
      }
      System.out.println("\n");
      System.out.print("Accending order number : ");
      Arrays.sort(num);
        for(i = 0;i < l;i++){
      System.out.print("  " + num[i]);
      }
      }
    }


  2. #2
    Banned
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: how array works ?

    once more
    public class array1dimensi
    {
     
     
    public static void main(string args[])
    {
       int i;
       int B[];   //deklarasi aray B
     
       B=new int[5];  // instansiasi  -->create array dgn 5 elemen ---> A[0],A[1],....,A[4]
     
       // Input
     
       i=0;
       while (i<=4)
       {
       B[i]=0;
       i=i+1;
     
       }
     
      //
      Max=A[0];
      i=0;
      while (....)
      {
      	if (......)
      	{
      	   ........
      	}
     
     
       // Output
     
       System.out.prinln ("Total="+total);
     
     
     
     
        }
     
      }

  3. #3
    Member
    Join Date
    Jan 2012
    Location
    Hellas
    Posts
    284
    Thanks
    11
    Thanked 59 Times in 57 Posts

    Default Re: how array works ?

    Hello erdy_rezki!
    What is your question? In the first post you initialize an array, you print it, you sort it and then you print it again.
    What are you trying to do with the second post's code?

  4. #4
    Banned
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: how array works ?

    Quote Originally Posted by andreas90 View Post
    Hello erdy_rezki!
    What is your question? In the first post you initialize an array, you print it, you sort it and then you print it again.
    What are you trying to do with the second post's code?
    yes andreas90, i want to ask how system array work? and what the different among code one and second, thank you

  5. #5
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,178
    My Mood
    Hungover
    Thanks
    141
    Thanked 600 Times in 515 Posts

    Default Re: how array works ?

    This is the first result for googling "java arrays": Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. [SOLVED] Method works, value not returned.
    By SPACE MONKEY in forum Object Oriented Programming
    Replies: 2
    Last Post: April 29th, 2012, 09:23 AM
  2. [SOLVED] Jar file only Works on my computer?
    By Java Programmer in forum What's Wrong With My Code?
    Replies: 42
    Last Post: January 8th, 2012, 06:20 AM
  3. I have no idea how this works.
    By GeneralPihota in forum Algorithms & Recursion
    Replies: 3
    Last Post: December 29th, 2011, 08:55 PM
  4. GUI Only Works Sometimes
    By bgd223 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: July 12th, 2011, 08:08 AM
  5. This program works but Want to improve
    By SHStudent21 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 8th, 2011, 04:53 PM