――I wanted to make an android app. .. .. .. .. And an easy idea
But I thought that C language would be difficult because of my prejudice and image.
The execution environment can also be executed on the web, so I think it's easier to try a simple program there.
paiza.io
https://paiza.io/ja/projects/new
The first program is Hello World </ strong>! !!
Test.java
public class Test {
public static void main ( String[] args ) {
System.out.println("Hello world");
}
}
Run! !! Result → Hello World
What is an array? ??
Variables are "boxes for storing values" in programming languages. You can enter a value in the middle of the process and retrieve it in reverse. The idea is the same as the variables (x and y) that appear in mathematics. Based on the above, "an array (highlet)" is "a combination of multiple variables". Reference URL
https://wa3.i-3-i.info/word11924.html
Array boilerplate
Array name = new type [number] </ strong>
Main.java
public class Main{
public static void main (String[] args){
int [] retu; //Declare an array(I'm about to start the array.)
retu = new int [3];//Generate(How long is the box? ?? Notice)
retu[0] = 1; //Substitute 1 for the 0th of retu
retu[1] = 2; //Substitute 2 for the first of retu
retu[2] = 10; //Substitute 10 for the second of retu
System.out.println(retu[0]);
System.out.println(retu[0] + retu[2]);
}
}
And like this
The
But I think this way of writing is fine ..........
Main1.java
public class Main1{ //How to write an array How to output
public static void main(String[] args){
int a[] = {1,2,3};
System.out.println(a[1]);
}
}
This is correct because it is an article written so that Java beginners will not forget it I don't think it's absolutely possible. Writing, deprecation, grammar, etc. may be incorrect, so this is for reference only! !!
Recommended Posts