Partization in Java

An article released exclusively on October 20, 2017.

package

package package name;
import package name; //FQCN can be omitted.

class

To call a method of another class, specify as follows.

name of the class.Method name;

Mesot

Main.java


public class Main {
        public static void main (String args[]) {
            System.out.println("This is the Tokaido Shinkansen.");
            others.keikyu(); //Specify class
            System.out.println("Linear is here!");
            System.out.println(linear(new java.util.Scanner(System.in).nextLine()) + "The number of flights was reduced to books!");
        }
        public static int linear (String afraid) { //Specify the return value and argument type
            System.out.println(afraid + "And so on ...");
            int howmany = new java.util.Random().nextInt(100);
            System.out.println("1 day" + howmany + "It will reduce the number of flights to books!");
            return howmany; //Returns a variable
        }
}

others.java


public class others {
    public static void keikyu () {
        System.out.println("Akaden, I'm pulling it out!");
    }
}

Recommended Posts

Partization in Java
Changes in Java 11
Rock-paper-scissors in Java
Pi in Java
FizzBuzz in Java
[java] sort in list
Read JSON in Java
Make Blackjack in Java
Constraint programming in Java
Put java8 in centos7
NVL-ish guy in Java
Combine arrays in Java
"Hello World" in Java
Callable Interface in Java
Comments in Java source
Azure functions in java
Format XML in Java
Simple htmlspecialchars in Java
Boyer-Moore implementation in Java
Hello World in Java
Use OpenCV in Java
webApi memorandum in java
Type determination in Java
Ping commands in Java
Various threads in java
Heapsort implementation (in java)
Zabbix API in Java
ASCII art in Java
Compare Lists in Java
POST JSON in Java
Express failure in Java
Create JSON in Java
Date manipulation in Java 8
What's new in Java 8
Use PreparedStatement in Java
What's new in Java 9,10,11
Parallel execution in Java
Initializing HashMap in Java
Try using RocksDB in Java
Avoid Yubaba's error in Java
Get EXIF information in Java
Save Java PDF in Excel
Edit ini in Java: ini4j
Java history in this world
Let Java segfault in 6 lines
Try calling JavaScript in Java
Try developing Spresense in Java (1)
Try functional type in Java! ①
I made roulette in Java.
Create hyperlinks in Java PowerPoint
Implement two-step verification in Java
Refactoring: Make Blackjack in Java
Write flyway callbacks in Java
Topic Analysis (LDA) in Java
Importing Excel data in Java 2
NEologd preprocessing in Java neologdn-java
Change java encoding in windows
Java Stream API in 5 minutes
Cannot find javax.annotation.Generated in Java 11
Read standard input in Java
Implement Basic authentication in Java