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 8583161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:28:05+00:00 2026-06-11T21:28:05+00:00

private String[][] var[] This code compiles. But shouldn’t they make the array on type

  • 0
private String[][] var[]

This code compiles. But shouldn’t they make the array on type or variable?

  • 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-11T21:28:07+00:00Added an answer on June 11, 2026 at 9:28 pm

    The code is the same as this:

    private String[][][] var;
    

    All these forms are equivalent:

    private String[][][] var;
    private String[][] var[];
    private String[] var[][];
    private String var[][][];
    

    And they all mean the same: a three-dimensional array of strings. The String var[][][] syntax may seem a bit weird, but it’s like that for making C/C++ programmers feel right at home in Java (that’s how you normally declare an array type in C/C++).

    In Java, the String[][][] var syntax is preferred, as it makes clear that the type of var is String[][][], in the other syntax and its different variations the type information is split before and after the variable – although it’s perfectly legal from the compiler’s view point, it’s harder to read.

    Even weirder, all these method declarations are legal and equivalent:

    String[][][] m()  {return null;}
    String[][] m() [] {return null;}
    String[] m() [][] {return null;}
    String m() [][][] {return null;}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in my code-behind file of my View: private string GetSelectedSchoolclassCode()
I build some validation service. private static void Main(string[] args) { var service =
I have the following code: private String foo; public void setFoo(String bar) { foo
I have this class: Class B { private String D; private String E; }
Consider this simple example - public class Person { private String name; private Date
Assume this Java code: public class A { public A(String g) { x +=
I have a scala class: class Foo { def this(st: String) { var baz
I implemented this code: C# Processing Fixed Width Files But since my work PC
I'm try to port some code from D2007 to DXE2. This simplified code compiles
private String setDate(int day) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.DATE, + day);

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.