11.1. Java versus C# Arrays

Although arrays are syntactically declared in the same way in Java and C#, there some differences in the way arrays are treated in the two languages.

11.1.1. Java Arrays

In Java, arrays are first-class objects, but there is no single class that defines an array. Furthermore, Java arrays are not collections; although the java.util.Arrays class exists alongside other collection classes, it is primarily a utility class with all static methods to manipulate arrays. Declaring an array does not create an array object nor allocate space in memory; instead, it creates a variable with a reference to an array. Array variable declarations must indicate a dimension by using []. Java array indices start from 0. All array elements ...

Get .NET for Java Developers: Migrating to C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.