CSharp Certification, Development, and Training | Recent changes | Edit this page | Page history

Printable version | Disclaimers | Privacy policy

Not logged in
Log in | Help
 

C# FAQ: What is the difference between CSharp and Java array declarations

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio

CSharp-Online.NET:FAQs
edit

What is the difference between C# and Java array declarations?

In the Java language, there are two methods of declaring arrays. The first method is backwards compatible with C and C++ notation. The second is generally acknowleged as being more easily read and maintained.

C# uses only the second array declaration syntax. The following are examples in both the C# and Java languages:

// C# example
int[] intArray     = new int[10];   // intArray is a type int[] object
float floatArray[] = new float[10]; // compile error 
// Java example
int[] intArray     = new int[10];   // intArray is a type int[] object
float floatArray[] = new float[10]; // floatArray is a type float[] object 

See also


[CSharp Certification, Development, and Training]
C# Certification, Development, and Training (Home)
ASP.NET
C# and Visual C#
C# .NET Articles
C# .NET Glossary
C# .NET Resources
C# .NET Reviews
C# .NET Tutorials
C# .NET Videos
Microsoft .NET Framework
Microsoft Visual Studio .NET

Edit this page
Discuss this page
Page history
What links here
Related changes

Special pages
Bug reports