Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8430015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:29:37+00:00 2026-06-10T05:29:37+00:00

I come across this code line in a book and it said this is

  • 0

I come across this code line in a book and it said this is legal , but I don’t really understand though having googling.
the code is:

Boolean [] ba [];

I just know that to create an array, it should be like this:

int [] numberArray;

int numberArray [];

int [] [] num2DArray;

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:29:39+00:00Added an answer on June 10, 2026 at 5:29 am

    All those 3 declarations have the same meaning in java :

    Boolean  [][] ba ;
    Boolean  [] ba [];
    Boolean  ba [][] ;
    

    I don’t really like it but as there aren’t any confusion possible, there is no very big harm in letting them be equivalent. The rationale was that C and C++ coders were used to a certain notation :

     int a[];
    

    while the recommendation in java is to consistently declare the type before as in

     int[] a;
    

    Here’s the reference : http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html#jls-10.2

    And two extracts :

    Brackets are allowed in declarators as a nod to the tradition of C and
    C++. The general rules for variable declaration, however, permit
    brackets to appear on both the type and in declarators, so that the
    local variable declaration

    […]

    We do not recommend “mixed notation” in an array variable declaration,
    where brackets appear on both the type and in declarators.

    In order to be more readable in Java, I suggest you stick to the usual

     Boolean[][] ba ;
    

    Note that you have a similar behavior for method declarations. Here’s an excerpt from the ByteArrayOutputStream class source code:

    public synchronized byte toByteArray()[] {
        return Arrays.copyOf(buf, count);
    }
    

    This is allowed for compatibility but please don’t use that. Most coders at first sight wouldn’t notice the [] and thus wouldn’t immediately read that this method returns an array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I come across this code in my web.xml but I don't understand what it
I have come across this line of legacy code, which I am trying to
Just come across the following line of code and having a hard time finding
I've come across this twice now. Sometimes using the following line of code: [self.navigationController
I'm looking over some previous developers code and I come across this line: location.href
I have just come across this code: function test(){ //... if ( $profilerule ==
In some code I've been reading, I've come across this : class Someclass {
I've come across code that looks like this: NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:1024
I've come across a piece of Haskell code that looks like this: ps@(p:pt) What
I have never come across this issue but most recently I noticed that a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.