[Java] Introduction to Java

[Java] Introduction to Java

I even studied "sequential progress," "conditional branching," and "repetition."

Run

Hello.java


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

output


Hello

variable

Variable.java


class variable {
    public static void main(String[] arg){
        int var = 1;
        System.out.println(var);
    }
}

output


1

Array

Array.java


class Array{
    public static void main(final String[] args) {
        int[] arr = new int[] { 8, 12, 21 };
         System.out.println("breakfast" + arr[0] + "From time");
         System.out.println("lunch" + arr[1] + "From time");
         System.out.println("Supper" + arr[2] + "From time");
    }
}

output


Breakfast is from 8 o'clock
It's from 12:00 lunch
It's from 21:00 at night

Conditional branch

Age.java


class Age{
    public static void main(String[] args){
   
      int humidity;
      humidity = 50;

      if (humidity >= 60){
        System.out.println("Humidity" + humidity + "%is");
        System.out.println("I'm messy");
      }else if((humidity <= 60) && (humidity >= 40)){
        System.out.println("Humidity" + humidity + "%is");
        System.out.println("Comfortable");
      }else if(humidity <= 40) {
        System.out.println("Humidity" + humidity + "%is");
        System.out.println("I'm crazy");
      }

    }
}

output


Humidity is 50%
Comfortable

Environment

Install JDK and editor VSCode on windows

References

This article was written with reference to the following information. Kinocode / YouTuber for programming learning videos

Recommended Posts

[Java] Introduction to Java
Introduction to java
Introduction to java command
[Java] Introduction
[Java] Introduction to lambda expressions
[Java] Introduction to Stream API
[Introduction to rock-paper-scissors games] Java
Introduction to Ruby 2
[Introduction to Java] About lambda expressions
[Introduction to Java] About Stream API
Introduction to SWING
Introduction to Functional Programming (Java, Javascript)
Introduction to Micronaut 1 ~ Introduction ~
Introduction to migration
Introduction to Doma
Introduction to java for the first time # 2
[Introduction to Java] How to write a Java program
Output of the book "Introduction to Java"
Introduction to monitoring from Java Touching Prometheus
[Introduction to Java] Variable declarations and types
Introduction to Java Web Apps Performance Troubleshooting
Introduction to algorithms with java --Search (breadth-first search)
Java Performance Chapter 1 Introduction
Introduction to JAR files
Changes from Java 8 to Java 11
Sum from Java_1 to 100
Introduction to Ratpack (8)-Session
Introduction to RSpec 1. Test, RSpec
Introduction to bit operation
Introduction to Ratpack (6) --Promise
Introduction to Ratpack (9) --Thymeleaf
[Java] Connect to MySQL
Introduction to PlayFramework 2.7 ① Overview
Introduction to Android Layout
Introduction to design patterns (introduction)
Kotlin's improvements to Java
Introduction to javadoc command
From Java to Ruby !!
Introduction to jar command
Introduction to Ratpack (2)-Architecture
Introduction to lambda expression
Introduction to RSpec 2. RSpec setup
Introduction to Keycloak development
Introduction to javac command
[Introduction to Java] About type conversion (cast, promotion)
Introduction to algorithms with java --Search (bit full search)
[Monthly 2017/04] Introduction to groovy !! ~ Java grammar / specification comparison ~
An introduction to Groovy for tedious Java engineers
[Introduction to Java] Basics of java arithmetic (for beginners)
Introduction to Design Patterns (Builder)
[Java] How to use Map
How to lower java version
Migration from Cobol to JAVA
[Java] How to use Map
Convert Java Powerpoint to XPS
Java adds table to PDF
How to uninstall Java 8 (Mac)
Java to play with Function
Java --How to make JTable
Introduction to RSpec 5. Controller specs
Introduction to RSpec 6. System specifications