Java find the size of an array

Filed Under (java) by admin on 15-11-2011

Use Java Array Length.

Example:

String months[] = {"Jan", "Feb", "Mar", "Apr", "May",
 "Jun", "July", "Aug", "Sep", "Oct", "Nov", "Dec"};

System.out.println(months.length);

Value of months.length is equal to 12

Post a comment

ads
ads

Jobs at Lexmark Cebu

Software Tools Developer 5 Dec 2008, 1:11 pm

Software Tools Developer

Source: Jobs at Lexmark Jobs at Lexmark |

Company Nurse 5 Dec 2008, 1:11 pm

Company Nurse

Source: Jobs at Lexmark Jobs at Lexmark |

Industrial Designer 5 Dec 2008, 1:11 pm

Industrial Designer

Source: Jobs at Lexmark Jobs at Lexmark |

Data Owner 5 Dec 2008, 1:11 pm

Data Owner

Source: Jobs at Lexmark Jobs at Lexmark |

Firmware Product Systems Engineer (FPSE) 5 Dec 2008, 1:11 pm

Firmware Product Systems Engineer (FPSE)

Source: Jobs at Lexmark Jobs at Lexmark |

Talent Management Specialist 5 Dec 2008, 1:11 pm

Talent Management Specialist

Source: Jobs at Lexmark Jobs at Lexmark |

Business Control Analyst (Auditor) 5 Dec 2008, 1:11 pm

Business Control Analyst (Auditor)

Source: Jobs at Lexmark Jobs at Lexmark |

SAP System Analyst 5 Dec 2008, 1:11 pm

SAP System Analyst

Source: Jobs at Lexmark Jobs at Lexmark |

Firmware Development Engineers 5 Dec 2008, 1:11 pm

Firmware Development Engineers

Source: Jobs at Lexmark Jobs at Lexmark |

HR Officer (Shared Services) 5 Dec 2008, 1:11 pm

HR Officer (Shared Services)

Source: Jobs at Lexmark Jobs at Lexmark |

Technical Writers 5 Dec 2008, 1:11 pm

Technical Writers

Source: Jobs at Lexmark Jobs at Lexmark |

Spanish-speaking Customer Service Representative 5 Dec 2008, 1:11 pm

Spanish-speaking Customer Service Representative

Source: Jobs at Lexmark Jobs at Lexmark |

Technical Illustrator 5 Dec 2008, 1:11 pm

Technical Illustrator

Source: Jobs at Lexmark Jobs at Lexmark |

Recruitment Assistant 5 Dec 2008, 1:11 pm

Recruitment Assistant

Source: Jobs at Lexmark Jobs at Lexmark |

Team Lead 5 Dec 2008, 1:11 pm

Team Lead

Source: Jobs at Lexmark Jobs at Lexmark |

Technical Support Representative 5 Dec 2008, 1:11 pm

Technical Support Representative

Source: Jobs at Lexmark Jobs at Lexmark |

Technical Trainer 5 Dec 2008, 1:11 pm

Technical Trainer

Source: Jobs at Lexmark Jobs at Lexmark |

Software Build and Library Administrator 5 Dec 2008, 1:11 pm

Software Build and Library Administrator

Source: Jobs at Lexmark Jobs at Lexmark |

Business Database Administrator 5 Dec 2008, 1:11 pm

Business Database Administrator

Source: Jobs at Lexmark Jobs at Lexmark |

EDI - Support Analyst 5 Dec 2008, 1:11 pm

EDI - Support Analyst

Source: Jobs at Lexmark Jobs at Lexmark |