I'm new to Java. I will describe what I have learned.
When carefully arranging one by one
String[] memo = new String[5]; //Assign 5 arrays to memo variables
memo[0] = "Daikon radish" ;
memo[1] = "Carrot" ;
memo[2] = "Mackerel" ;
memo[3] = "Lemon" ;
memo[4] = "Mustard" ;
String fruits = memo[3] ; //memo[3]Substitute an array of
System.out.println( fruits );
(Console execution result)
Lemon
String[] memo = {"Daikon radish","Carrot","Mackerel","Lemon","Mustard"};
String fruits = memo[0] ;
System.out.println( fruits )
String[][] animal = {
{"Eagle","Taka"},
{"Chinchilla","hamster"},
{"Parakeet","Pigeon"},
{"Dachshund","Chihuahua"}
};
System.out.println(animal[0][0]); //Eagle
System.out.println(animal[0][1]); //Taka
System.out.println(animal[1][0]); //Chinchilla
System.out.println(animal[1][1]); //hamster
System.out.println(animal[2][0]); //Parakeet
System.out.println(animal[2][1]); //Pigeon
System.out.println(animal[3][0]); //Dachshund
System.out.println(animal[3][1]); //Chihuahua
From the target file, "Execution" → "Execution configuration"
Search for the target file → select
Select "Arguments" and enter the array information in "args" (if there are multiple, put a space)
int variable= Integer.parseInt(args[0])
class args {
public static void main (String[] args) {
String input1 = args[0] ; //iOS is included
String input2 = args[1] ; //Android is included
String input3 = args[2] ; //windows are included
String input4 = args[3] ; //Mac is in
System.out.println( input1 );
System.out.println( input2 );
System.out.println( input3 );
System.out.println( input4 );
}
}
Recommended Posts