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

  • Home
  • SEARCH
  • 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 6799921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:54:23+00:00 2026-05-26T18:54:23+00:00

what is the difference between: String a[] and List<String> a ? Is String a[]

  • 0
  1. what is the difference between: String a[] and List<String> a?
  2. Is String a[] correct? or for defining array of strings we should use String[] a always?
  3. When we declare String[] a, do we need to initialize it always?

Suppose i do this:

String[] a = new String[5];
a[2] = "Hello";
a[3] = "World";
a[2] = "Good Bye";

Since array is stored contiguously in memory and when i modify a string new string object is created. How does all these strings stored and modified in Java for all of the above statements?

  • 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-05-26T18:54:24+00:00Added an answer on May 26, 2026 at 6:54 pm
    1. String a[] is a native Java array of Strings. List a is a raw (untyped) List (see The Java Collections). You probably want the genericised version: List<String> a. There are far too many differences to list here; you should follow that link!
    2. String a[] and String[] a are equivalent. String[] a is the convention, though.
    3. String[] a is actually a reference. If it’s a non-local variable, it will be implicitly initialised to null if you don’t explicitly initialise it. You commonly will want to do something like String[] a = new String[10];.
    4. Each element of the array is a reference to a String; the underlying data itself is not stored in the array.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to sort a List based on the difference between the strings in
What's the difference between a string and a symbol in Ruby and when should
I understand the difference between String and StringBuilder ( StringBuilder being mutable) but is
What is the difference between String and StringBuffer in Java? Is there a maximum
What's the difference between String.matches and Matcher.matches? Is there any difference in terms of
Possible Duplicate: What is the difference between String.Empty and “” Is equivalent to String.Empty
In VB what is the difference between String.Format({0:X1}, abyte) and String.Format({0:X2}, abyte) abyte is
Just to make this clear - what is the difference between: String(value) and value
In .NET, what is the difference between String.Empty and "" , and are they
What's the difference between std::string and std::basic_string ? And why are both needed?

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.