Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2008, 09:40 PM
Member
 
Join Date: Aug 2008
Posts: 6
Rep Power: 0
kris09 is on a distinguished road
Question what does num.length method does?
i was wondering what does num.length method does ?



import java.util.*;

public class array2{
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]);
}
}
}
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 08-07-2008, 10:19 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
Rep Power: 4
Norm is on a distinguished road
Default
length is like a field for an array. It gives the number of elements in the array.
A method is coded with ending () -> size()
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
queue length of Socket hemant Networking 6 07-13-2008 06:28 PM
Integer length jithan New To Java 1 06-12-2008 03:35 PM
Demonstration of the variable length arguments Java Tip java.lang 0 04-17-2008 07:38 PM
Determining Midi Length Usagi New To Java 0 12-08-2007 11:45 PM
Help with method length toby New To Java 1 07-25-2007 08:29 PM


All times are GMT +2. The time now is 04:08 PM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org