I would like to take a quick look back at what I have studied Java.
Environment (tool) required or used for learning Java 1.JDK A summary of the functions required when creating Java Reference: https://wa3.i-3-i.info/word15006.html Installation reference: https://eng-entrance.com/java-install-jdk-windows 2.Eclipse IDE (Integrated Development Environment) → Tool for actually developing Java Reference: https://www.sejuku.net/blog/72127 Installation reference: https://techfun.cc/java/windows-eclipse-install.html 3. Eclipse Japanese localization package For using Eclipse in Japanese Installation reference: https://www.javadrive.jp/eclipse3/install/index4.html
Once the environment (tools) is complete, the next step is development.
Write a statement to the computer. Actually the main work is here. For example, like this
package abc;
public class Main {
public static void main(String[] args) {
System.out.println("Nice to meet you");
}
}
Translate the source code described above into words that can be understood by a computer, Or it will check if the grammar is correct. This is done in Eclipse. If the grammar is incorrect, modify the source code.
The computer works according to the contents specified in the source code. Console with the above source code (where you can talk to your computer) "Nice to meet you" is displayed in the part.
package abc;
public class Main {
public static void main(String[] args) {
System.out.println("Nice to meet you");
}
}
The project is not displayed because it is a "box" that surrounds the whole Of the Main class (3rd line) in the abc package (1st line) You can see that we are using the main method (4th line).
I would like to compare each "box" to a "company". This time, the part written as "company (project)" in the figure I would like to make it.
Reception (Main class)
package generalAffairsDepartment;
import systemDevelopmentDepartment.FirstDivision;
public class Main {
public static void main(String[] args) {
System.out.println("Receptionist: Nice to meet you, what kind of business do you have?");
//Enter your name and the person you want to call.
System.out.println("Please enter your name.");
String yourName = new java.util.Scanner(System.in).nextLine();
System.out.println("Please enter the person you want to call.");
String callerName = new java.util.Scanner(System.in).nextLine();
System.out.println("Me: me," + yourName + "My name is.");
System.out.println("myself:" + callerName + "Do you have any?");
System.out.println("Receptionist:" + callerName + "is not it?");
System.out.println("Receptionist: We will call you so please wait here");
//Now call the engineer method of the system development department.
String requestDetails = FirstDivision.engineer(yourName, callerName);
System.out.println("After several hours,,,");
System.out.println(callerName + ":Sorry I made you wait.");
System.out.println(callerName + ":" + requestDetails + "Was completed.");
System.out.println("Self: Thank you.");
}
}
System Development Department First Division (First Division class)
package systemDevelopmentDepartment;
public class FirstDivision {
public static String engineer(String yourName, String callerName) {
System.out.println(callerName + ":Nice to meet you," + callerName + "My name is.");
System.out.println(callerName + ": What kind of business do you have?");
System.out.println("Please enter what you want to make.");
//Enter what you want the engineer to make.
String requestDetails = new java.util.Scanner(System.in).nextLine();
System.out.println("myself;" + requestDetails + "I want you to make.");
System.out.println(callerName + ": I understand." + requestDetails + "is not it?");
System.out.println(callerName + ": Please wait at the reception.");
//Returns the created one to the main method.
return requestDetails;
}
}
Execution and input results (contents displayed on the console) It is possible to combine the main method and engineer method into one class, This time I wanted you to see that packages and classes have roles It took a shape like this.
Next time, I would like to write about "variables"!
Recommended Posts