|
It works if you replace "lenght" by "length". Code: ... for (int count2 = 0; count2 < letters.length; count2++) ... Mattias "Maarten Vries, de" <m_devries74@hotmail.com> Sent by: owner-java400-l@midrange.com 14.02.01 13:04 Please respond to JAVA400-L To: JAVA400-L@midrange.com cc: Subject: ARRAY - Char Is it possible to get the length of a Char Array: Here is my code: char[] letters = current.toCharArray(); for (int count2 = 0; count2<letters.lenght; count2++) and here is the error: Wheel.java:33: Attempt to reference field lenght in a char[]. for (int count2 = 0; count2<letters.lenght; count2++) { ^ It looks like you can only get the lenght of an INT but not from a CHAR. Am I right about this or not? Maarten _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Return-Path: <m_devries74@hotmail.com> Received: (from uucp@localhost) by linux.midrange.com (8.9.3/8.8.7) with UUCP id FAA30738 for java-l@midrange.com; Wed, 14 Feb 2001 05:55:07 -0600 Received: from hotmail.com (f298.law10.hotmail.com [64.4.14.173]) by uucphost.mcs.net (8.11.1/8.11.1) with ESMTP id f1EAjwG11996 for <java-l@midrange.com>; Wed, 14 Feb 2001 04:45:59 -0600 (CST) (envelope-from m_devries74@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 14 Feb 2001 02:45:52 -0800 Received: from 167.202.196.72 by lw10fd.law10.hotmail.msn.com with HTTP; Wed, 14 Feb 2001 10:45:52 GMT X-Originating-IP: [167.202.196.72] From: "Maarten Vries, de" <m_devries74@hotmail.com> To: java-l@midrange.com Subject: Array lenght Date: Wed, 14 Feb 2001 11:45:52 +0100 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: <F298V1qdiixjnzi95Hf00004be6@hotmail.com> X-OriginalArrivalTime: 14 Feb 2001 10:45:52.0843 (UTC) FILETIME=[4D4951B0:01C09673] Hi Can anyone tell me if it is possible to get the length of a CHAR array? When I use this code: char[] letters = current.toCharArray(); for (int count2 = 0; count2<letters.lenght; count2++) I get the message: Wheel.java:33: Attempt to reference field lenght in a char[]. for (int count2 = 0; count2<letters.lenght; count2++) { Maarten _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. (See attached file: C.DTF)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.