Path: ...!weretis.net!feeder9.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail From: cross@spitfire.i.gajendra.net (Dan Cross) Newsgroups: comp.os.vms Subject: Re: Simple Pascal question Date: Thu, 8 Aug 2024 05:33:01 -0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: References: Injection-Date: Thu, 8 Aug 2024 05:33:01 -0000 (UTC) Injection-Info: reader1.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80"; logging-data="10745"; mail-complaints-to="abuse@panix.com" X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: cross@spitfire.i.gajendra.net (Dan Cross) Bytes: 2359 Lines: 47 In article , Arne Vajhøj wrote: >On 8/4/2024 9:58 PM, Dan Cross wrote: >> In article , >> Arne Vajhøj wrote: >>> On 8/4/2024 8:09 PM, Dan Cross wrote: >>>> In article , >>>> Arne Vajhøj wrote: >>>>> Like: >>>>> >>>>> public class FlexArray { >>>>> private static void dump(int[] a) { >>>>> for(int v : a) { >>>>> System.out.printf(" %d", v); >>>>> } >>>>> System.out.println(); >>>>> } >>>>> public static void main(String[] args) throws Exception { >>>>> int[] a1 = { 1 }; >>>>> int[] a2 = { 1, 2 }; >>>>> int[] a3 = { 1, 2, 3 }; >>>>> dump(a1); >>>>> dump(a2); >>>>> dump(a3); >>>>> } >>>>> } >>>> >>>> Java arrays are more like the aforementioned slices. >>> >>> I don't think so. >>> >>> Java does not have anything like slices. >> >> An array in Java is a pointer and a length. A slice is a >> pointer and a length. > >An array in Java is an object containing data type, array >length and all the elements. > >Which is not the same as a structure containing a >pointer to somewhere in another object and a length. Like I said, you should go learn a little bit about language design. You're thinking is muddled with object oriented paradigms, whether they apply or not. - Dan C.