Results 1 to 3 of 3

Thread: Object oriented programming with java

  1. #1
    Join Date
    Jan 2012
    Posts
    12

    Object oriented programming with java

    Can someone please tell me what an array is, and what are the advantages of using arrays? Also please type a few lines of code demonstrating how you would declare an array and initialize it.

    Please help.

  2. #2
    Join Date
    Nov 2010
    Posts
    76

    Re: Object oriented programming with java

    Array is mainly significant thing in any programming language. Array is a fixed memory allocation and this will assign the memory for same data type sequence. Array contains multiple values of same types and this all values are set memory at same size. Multiple type of array used in all programming language such as one - dimensional, two - dimensional or can say multi - dimensional.
    Declaration of an array:
    int new[]; or int new= new int[2]; or int num[] = {5,2,4,8,7,6};

    Here is the code of the program:

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

  3. #3
    Join Date
    Jan 2012
    Posts
    12

    Re: Object oriented programming with java

    Thank you so much for your great explanation.

Similar Threads

  1. Replies: 4
    Last Post: 11-07-2011, 02:39 PM
  2. Replies: 3
    Last Post: 08-01-2011, 05:23 AM
  3. Replies: 3
    Last Post: 08-01-2011, 05:20 AM
  4. static methods in object oriented programming
    By Satchel in forum Software Development
    Replies: 5
    Last Post: 07-01-2011, 08:58 PM
  5. The OOP Object Oriented programming Concept & its principle?
    By Bhavya in forum Software Development
    Replies: 3
    Last Post: 25-02-2009, 08:16 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
  •