Skip to content
Advertisement

Is there a maximum size to char[]?

IN JAVA

Is there a maximum size of char[]? Can I have a char[5,000,000]?

Is array in java composed of contiguous memory blocks?

Advertisement

Answer

Since the index is int based the maximum size of an array should be Integer.MAX_VALUE

Obviously the other limit is the amount of memory available to your application 🙂

Advertisement