List of frequently used Java instructions (for beginners and beginners)

List of frequently used instructions

Comment out

//Two slashes on one line

/*If there are multiple lines
With slash
Surround with an asterisk
*/

Receive a single line of string from the keyboard

//Assign the entered string to the variable words
String words = new java.util.Scanner(System.in).nextLine();

Receive one integer from the keyboard

//Assign the entered integer to the variable value
int value = new java.util.Scanner(System.in).nextInt();

Display character string (with line break)

System.out.println("Character string to display");

Display character string (no line break)

System.out.print("Character string to display");

Convert string to integer

int n = Integer.parseInt(stringNumber);

Example: Convert 1 and 2 of character string to integer and add

String s_1 = "1";
String s_2 = "2";

//Add as a string->12 is output
System.out.println(s_1 + s_2);

//Convert to integer
int i_1 = Integer.parseInt(s_1);
int i_2 = Integer.parseInt(s_2);

//Convert to an integer and then add->3 is output
System.out.println(i_1 + i_2);
<Execution result>
12
3

Recommended Posts

List of frequently used Java instructions (for beginners and beginners)
[For beginners] Summary of java constructor
Java for beginners, expressions and operators 1
Java for beginners, expressions and operators 2
Classes and instances Java for beginners
Frequently used functions and commands of Xcode
[For beginners] Difference between Java and Kotlin
List of download destinations for oracle java
[Java] Contents of Collection interface and List interface
Kantai Collection Java # 1 Classes and Objects [For Beginners]
A collection of simple questions for Java beginners
[Introduction to Java] Basics of java arithmetic (for beginners)
Frequently used Java generics
List of beginners (List) memo
Get a list of MBean information for Java applications
[For beginners] DI ~ The basics of DI and DI in Spring ~
[For beginners] Quickly understand the basics of Java 8 Lambda
Introduction to Java for beginners Basic knowledge of Java language ①
List of MySQL sentences for programming beginners * Personal memo
[Java] Basic statement for beginners
Books used for learning Java
[Java] Beginner's understanding of Servlet-①
[Java] Summary of for statements
Java for beginners, data hiding
Advantages and disadvantages of Java
Java application for beginners: stream
Java while and for statements
Java beginners briefly summarized the behavior of Array and ArrayList
For Java beginners: List, Map, Iterator / Array ... How to convert?
[Java] Delete the elements of List
Utilization of Java array elements, for, length, value, and extended for statements
AWS SDK for Java 1.11.x and 2.x
Rock-paper-scissors game for beginners in Java
About fastqc of Biocontainers and Java
[For beginners] Run Selenium in Java
A list of rawValues for UITextContentType.
Sort a List of Java objects
Summary of frequently used Docker commands
Mechanism and characteristics of Collection implementation class often used in Java
Explanation of Ruby on rails for beginners ⑤ ~ Edit and delete database ~
List of members added in Java 9
[Java] Judgment of identity and equivalence
Generics of Kotlin for Java developers
[Docker] Other frequently used (probably) Docker Instructions
List of types added in Java 9
[For Java beginners] About exception handling
List of alternative distributions for CentOS
Get a list of S3 files with ListObjectsV2Request (AWS SDK for Java)
I wrote EX25 of AtCoder Programming Guide for beginners (APG4b) in java.
[Rails] Articles for beginners to organize and understand the flow of form_with
Implementation of clone method for Java Record
After 3 months of Java and Spring training
[Java] for Each and sorted in Lambda
List of point cuts for making finer point cuts
[Java] Inheritance and structure of HttpServlet class
Rails [For beginners] Implementation of comment function
List of methods used when manipulating strings
[Java / Swift] Comparison of Java Interface and Swift Protocol
[Java 7] Divide the Java list and execute the process
Features of spring framework for java developers
[Java] Proxy for logging SQL and SQL results