Programming for the first time in my life Java 1st Hello World

why? Is it Java?

――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

I tried it for the first time

The first program is Hello World </ strong>! !!

The code content is very difficult. I'm sorry!

Test.java


 
public class Test {
    public static void main ( String[] args ) {
        System.out.println("Hello world");
    }
}

Run! !! Result → Hello World

Let's generate an array! !!

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

array starts at 0th. So it doesn't start from the first </ h6> When extracting the contents of an array, specify the name of the array and specify the elements of the array.

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]);
    }
}
 

the end

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