Learn for the first time java # 3 expressions and operators

What is a formula?

public class Main {
	public static void main(String[] args) {
	    int a;
	    int b;
	    a = 20;
	    b =a+5;
		System.out.println(a);
		System.out.println(b);
	}
}

Execution result

20
25

Something like the 6th line is called an expression. "A", "b" and "5" are called operands, and "+" and "*" are called operators. Even if it is a complicated formula, all the formulas consist of these two.

literal

Among operants, what is described in the source code such as "5" and "hello, world" is called a literal. Literals have data types such as (int).

Escape sequence

A special character is represented by a description method that is described by the \ symbol followed by a single character.

Notation meaning
¥” Double quote symbol
¥ ’ Quote symbol
¥¥ Yen sign
¥n new line

operator

operator function
addition
- subtraction
multiplication
division
Remainder of division (remainder)
String concatenation
Substitute the right side for the left side
+= Add the left side and the right side and assign to the left side (as per the arithmetic operator)
++ Increase the value by one
--- Decrease the value by one

Recommended Posts

Learn for the first time java # 3 expressions and operators
Java for beginners, expressions and operators 1
Java for beginners, expressions and operators 2
Introduction to java for the first time # 2
Learning for the first time java [Introduction]
Learning memo when learning Java for the first time (personal learning memo)
Impressions and doubts about using java for the first time in Android Studio
Spring AOP for the first time
[First Java] Make something that works with Intellij for the time being
[Socket communication (Java)] Impressions of implementing Socket communication in practice for the first time
Creating an app and deploying it for the first time on heroku
Programming for the first time in my life Java 1st Hello World
I tried using Docker for the first time
Walls hit by Rspec for the first time
Android Studio development for the first time (for beginners)
I tried touching Docker for the first time
Use Java external library for the time being
Run Dataflow, Java, streaming for the time being
[Deep Learning from scratch] in Java 1. For the time being, differentiation and partial differentiation
[Java] Sort the list using streams and lambda expressions
Oreore certificate https (2020/12/19) for the first time with nginx
Prepare the environment for java11 and javaFx with Ubuntu 18.4
How to study kotlin for the first time ~ Part 2 ~
How to study kotlin for the first time ~ Part 1 ~
[Android studio / Java] What you don't understand when you touch it for the first time
Java while and for statements
[Rails] I tried using the button_to method for the first time
What is the LocalDateTime class? [Java beginner] -Date and time class-
[Java] Use ResolverStyle.LENIENT to handle the date and time nicely
Java sets the background color and background image for PowerPoint documents
Modeling a Digimon with DDD for the first time Part 1
A summary of what Java programmers find when reading Kotlin source for the first time
Access Web API on Android with Get and process Json (Java for the time being)
Think when Rails (turbolinks) doesn't load the page for the first time
[DL4J] Java deep learning for the first time (handwriting recognition using a fully connected neural network)
Java14 came out, so I tried record for the time being
AWS SDK for Java 1.11.x and 2.x
[Introduction] Installation of Docker Desktop for Mac for the first time and setup of virtual environment construction of CentOS
[MySQL] [java] Receive date and time
Read the first 4 bytes of the Java class file and output CAFEBABE
Classes and instances Java for beginners
The origin of Java lambda expressions
Java12 came out, so I tried the switch expression for the time being
For the time being, run the war file delivered in Java with Docker
[Java] How to get the current date and time and specify the display format
The story of releasing the Android app to the Play Store for the first time.
I translated the grammar of R and Java [Updated from time to time]
First steps for deep learning in Java
Nowadays Java lambda expressions and Stream API
Learn Java with "So What" [For beginners]
[Java] for Each and sorted in Lambda
[For beginners] Difference between Java and Kotlin
Java Programming Style Guide for the Java 11 Era
[Java] How to set the Date time to 00:00:00
[Java 7] Divide the Java list and execute the process
[Java] Proxy for logging SQL and SQL results
Learn Flyweight patterns and ConcurrentHashMap in Java
[Java8] Search the directory and get the file
[Java] Calculation mechanism, operators and type conversion
Use the l method for time notation
Ideal and reality that I felt when I used Optional for the first time ~ Implementation of cache using Map ~