Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: How to create an empty String Array?

I would like to create a series of Strings:

String a="";
String b="";
String c="";
String d="";
String e="";

And I would like to create a String Array to put these Strings into it, and I've tried to write like this:

String[] abcde = {"a","b","c","d","e"}

but it's not my desire as i just want the Strings to be empty... Sorry i know it seems just a simple question to you, but i'm a new learner, looking forward to hearing your help. Thanks!

like image 601
chunyuen2 Avatar asked Jun 05 '26 03:06

chunyuen2


2 Answers

This is a fairly simple task, you will simply want to use:

String[] abcde = {a, b, c, d, e}

You are wrapping your initial variables with "", this refers to a being "a" which is now a string with the character a.

I hope that will help you address your problem and here is a link for further help with strings. Strings Java

like image 72
Keeano Avatar answered Jun 07 '26 23:06

Keeano


just remove quotes

String[] abcde = {a, b, c , d , e };

like image 34
Tural Mehdiyev Avatar answered Jun 08 '26 00:06

Tural Mehdiyev