Let's study Java

Overall picture

https://www.guru99.com/java-tutorial.html I found it by chance and read it, but it was very easy to understand, so I introduced it without permission [^ 1].

[^ 1]: tell me java! I made it to throw the URL when I was told

While skipping only the installation work, I usually do Spring system maintenance The amount of lectures that takes about 10 hours in my case. If you can read English without translating it, it may end sooner.

First from here

https://www.guru99.com/java-platform.html

The following two may be skipped to build the environment 「Guide to Download & Install Java」 「How to Download & Install Java in Linux(Ubuntu)」

The following 5 can be seen if you are interested 「Groovy Script Tutorial for Beginners」 「C++ Vs JAVA: What’s the Difference?」 「Java vs C# - 10 Key Differences between Java and C#」 「Java vs Scala: What is the Difference?」 「JAVA Programming Tutorial for Beginners PDF」

When skipping environment construction

If your PC is barely full, go online. [^ 2] https://www.mycompiler.io/new/java

[^ 2]: I'm troubled by the lack of capacity of eMMC of low-priced PC, and I don't know how to set up PC in the first place! There are a lot of people at the level, and there are a lot of people who get stuck here

If you use it here, change the class name of the sample code to Main. Note that it will not work otherwise.

in this case


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

↓↓↓

do this


//Change from Demo to Main
class Main {
 public static void main(String args[]){
     System.out.println("Hello World");
 }
}

Why this site

It's a crunchy English site, but it doesn't have that difficult syntax It is rather just right because it is necessary to get used to English in order to proceed with development in the future. Of course, let's use google translate as well.

It's full of really good articles, but sometimes the code indentation is broken It makes me laugh because the editing of the image is complicated w [^ 3]

[^ 3]: It's full of feelings of working hard with paint

I especially liked the order of the lectures. How does a program work on a PC in the first place? There are many languages, but why Java? etc It is easy to understand because the questions are gradually solved step by step.

I think that "tell only what you need at that point" is thorough.

There is no explanation of basic grammar such as if or for here, it just appears in the sample code. Do you feel like moving the sample code and learning the movement from the results?

Articles of interest

After that, things that were personally useful or interesting Static variable https://www.guru99.com/java-static-variable-methods.html

static is created once when a class is created. It is initialized without instantiation.

Stack & Heap https://www.guru99.com/java-stack-heap.html

Heap… object Stack… methods, local variables, reference variables Code ... Bytecode (program) Static ... static data, static methods

Java switch Statement https://www.guru99.com/switch-java.html

When there are many iterations, it seems that the result can be processed faster than if ~ else nesting.

Multithreading in Java https://www.guru99.com/multithreading-java.html https://docs.oracle.com/javase/jp/8/docs/api/java/lang/Thread.html

Threads do not allocate separate memory areas. However, threads are independent, so any exception will have no effect.

The only thing I don't understand is the following behavior Even though it is setPriority, the result is 5. Neither guru99 nor oracle says it works like that Judging from the verification result, setPriority () for the thread in the TERMINATED state is ignored no matter what is set.

Sample code


public class Main implements Runnable {
    @Override
    public void run() {
    }
    public static void main(String[] args) {
        Thread guruthread1 = new Thread();
        guruthread1.start();
        try {
            guruthread1.sleep(1000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        guruthread1.setPriority(1);
        int gurupriority = guruthread1.getPriority();
        System.out.println(gurupriority);
        System.out.println("Thread Running");
  }
}

output


5
Thread Running

For testing


public class Main implements Runnable {
    @Override
    public void run() {
    }
    public static void main(String[] args) {
        // CHECK DEFAULT PRIORITY
        System.out.println("MIN:" + Thread.MIN_PRIORITY);
        System.out.println("NORMAL:" + Thread.NORM_PRIORITY);
        System.out.println("MAX:" + Thread.MAX_PRIORITY);
        
        Thread guruthread1 = new Thread();

        System.out.println("STATE/PRIORITY:" + guruthread1.getState() + "/" + guruthread1.getPriority());
        guruthread1.setPriority(1);
        System.out.println("STATE/PRIORITY:" + guruthread1.getState() + "/" + guruthread1.getPriority());
        
        guruthread1.start();
        
        try {
            guruthread1.setPriority(2);
            System.out.println("STATE/PRIORITY:" + guruthread1.getState() + "/" + guruthread1.getPriority());

            guruthread1.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        guruthread1.setPriority(3);
        System.out.println("STATE/PRIORITY:" + guruthread1.getState() + "/" + guruthread1.getPriority());

        System.out.println("Thread Running");
  }
}

output


MIN:1
NORMAL:5
MAX:10
STATE/PRIORITY:NEW/5
STATE/PRIORITY:NEW/1
STATE/PRIORITY:RUNNABLE/2
STATE/PRIORITY:TERMINATED/2
Thread Running

Convert JSON to XML using Gson and JAXB: JAVA Example https://www.guru99.com/json-to-xml-gson-jaxb.html

Hmm, there was such a library. https://github.com/google/gson

How to Reverse a String in Java using Recursion https://www.guru99.com/java-program-reverse-string.html

Uo, does java String have reverse () as standard? The sample uses recursion, but I think it's usually done in the opposite direction of for.

String myStr = "Guru99";
String reverseStr = "";

for(int i = myStr.length() - 1; i > -1; i--){
	reverseStr += myStr.charAt(i);
}

System.out.println("The reversed string is: " + reverseStr);

But this, -1 is unpleasant, so try to use Collections.reverse () from the array When I thought about it and wrote it, it was really hard if it was java.

This is the optimal solution.

String myStr = "Guru99";

StringBuffer sb = new StringBuffer(myStr);
String reverseStr = sb.reverse().toString();

System.out.println("The reversed string is: " + reverseStr);

20 Best Java Tools for Developers in 2020 https://www.guru99.com/java-tools.html

Groovy is included, but Java tools are expressed as w.

Java Spring Tutorial https://www.guru99.com/spring-tutorial.html

Spring is a lightweight framework which can be thought of as a framework of frameworks because it offers support for various frameworks such as Hibernate, Struts, Tapestry, JSF, etc.

Lightweight ...? The concept of Spring is well organized, but I don't know how to develop it with Spring in this article alone. I think the formula is good for Spring, but it may be difficult for beginners because it has git. https://spring.io/guides/gs/spring-boot/

JasperReports Tutorial https://www.guru99.com/jasperreports-tutorial.html

I see, is this a form creation tool? I didn't know because I had only used paid tools made by Nippon Vender Net.

Recommended Posts

Let's study Java
[Java] Study notes
Java 8 study (repeatable)
Java study memorandum
Study Java Silver 1
Let's touch on Java
Java Silver Study Day 1
[Java ~ Method ~] Study memo (5)
Java study # 1 (typical type)
[Java ~ Array ~] Study memo 4
My Study Note (Java)
Let's scrape with Java! !!
Study Java # 2 (\ mark and operator)
Let's experiment with Java inlining
Study java arrays, lists, maps
Amazing Java programming (let's stop)
Java Silver Study Method Memo
Let's operate Excel with Java! !!
[Java ~ Boolean value ~] Study memo (2)
Java study # 7 (branch syntax type)
Java
Java study memo 2 with Progate
Java
Study Java with Progate Note 1
How to study Java Silver SE 8
Summary of [Java silver study] package
[In-house study session] Java exception handling (2017/04/26)
Let's use Twilio in Java! (Introduction)
[Study session memo] Java Day Tokyo 2017
Java study # 4 (conditional branching / if statement)
Orcacla Java Bronze SE 7/8 Qualification Study
Java study # 5 (iteration and infinite loop)
Study Deep Learning from scratch in Java.
Java learning (0)
Studying Java ―― 3
[Java] array
Summary of in-house newcomer study session [Java]
Java protected
[Java] Annotation
Java array
Studying Java ―― 9
Java scratch scratch
java (constructor)
Java array
[Java] ArrayDeque
java (override)
java (method)
Java Day 2018
Java string
java (array)
Java static
Java serialization
java beginner 4
JAVA paid
Now let's recap the Java lambda expression
Studying Java ―― 4
Java (set)
java shellsort
[Java] compareTo
Studying Java -5
[Java ~ Variable definition, type conversion ~] Study memo