Java Tutorial - 14 - Arrays of Strings

preview_player
Показать описание

Learn how to program in java with our online tutorial. We will cover variables, loops, if else branching, arrays, strings, objects, classes, object oriented programming, conditional statements, and more.

Here we learn how to construct an array of strings in java.
Рекомендации по теме
Комментарии
Автор

Thank you so much!! I am a new fan of you! Love from India..!

snehaelizebeth
Автор

Hoping you can help me. So I have to read in a .txt file (which contains 100 names), and store them as arrays. I made a new String array and reserved 100 memory spots. Would I have to declare each element of the array one by one? Meaning that I have to list every single name inside my program?

Woogzzzie
Автор

How to compare 2 string arrays? For example:

String a[] = {“animal”, “food”, “place”};
String b[] = {“dog”, “cake”, ”japan”};

If (a[0].equals(b[0])){
//print Animal }

I know that .equals() won’t work for String arrays. I hope you help me with this!! Thank you for this video by the way 😊

tram
Автор

Can be used for environment identification.
Can be used for neighborhood identification.






Camera module not included.

invaderzim_
Автор

public static void main(String[] args) {
String daysOfWeek [] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
for (int i = 0; i < daysOfWeek.length; i++);{
System.out.println( daysOfWeek[i] );
//I am using this code to print string array and getting error
"Exception in thread "main" java.lang.Error: Unresolved compilation problem:
i cannot be resolved to a variable"
please help to fix it.

vijaypratapsingh
Автор

How do you convert an array of multiple strings into one big string?

nanometers
Автор

Can you please show the same input from console?? I mean taking input strings from console as a sentence and making them an array of words??

skasif
Автор

Do you have a video where you fill the array with user input? Great stuff thanks!

wsupercool
Автор

Thanks. How would I select an array at random, then display it? eg

var array = "array2" // pretend this was randomly chosen
String array1 = stuff, stuff2
String array2 = more, more2
String array3 = again, again2
System.out.println($array.2)
// I want to print out "more2"

channelkerr
Автор

public static void main (String [] args){
int things = 0;
boolean loop1 = true ;
char coba;
String i[] = new String[3];

Scanner sc = new Scanner(System.in) ;

do {
i[things] = sc.nextLine() ;
things++ ;

System.out.println("again?? (y/n)");
coba = sc.next().charAt(0);
if(coba == 'n' || coba == 'N') {
loop1 = false ;

}
}while(loop1);
}

so, i was trying to make user may input at least 1, and max 3 times name.
but it ended like this...

anomolisagag