02_JAVA project creation and input/output method description

Hello i'm MrChooCAI~!!!

JAVA project creation and input/output method description.

In this post, we will learn about how to create Java programs and how to use input/output methods. If you need practice, please refer to github for example codes related to input/output.

Github url: https://github.com/Chooyoungjun/javastudy/tree/main/01_print_method_input_method

JAVA project creation

 

In the figure above, it shows how the Java project is structured. In other words, it has the project as the largest category. The project can consist of multiple packages, the package can consist of multiple classes, and the class is a picture that shows that it consists of multiple methods. For example, assuming that you have created a bank management program project, as a package, um... It can also be divided into a deposit management system package and an employee management system package. And it can be seen that the deposit management package is further subdivided into deposit and withdrawal classes and loan classes. Lastly, there could be a deposit method or withdrawal method in the deposit and withdrawal class... These functions will make up the deposit and withdrawal class. So we're going to create the Java project based on the same criteria as the picture above.

[Practice]

From now on, we'll practice creating from project to class based on the Eclipse program.

1.     Create project


The snapshot above shows how to create a project in Eclipse. If you follow the snapshot above, you can create a javproject..

2.     Create package

You can create a package like the snapshot above.

3.     Create java class

You can create a class as well. When creating a project or package, you just have to follow it and create it. However, when creating a class, it is recommended to set up the main method auto-complete function, so I took a snapshot as follows.


Please check the public static @#$!@$ below. If you check it like this, you can see that it's completed as shown in the snap shot below.

I created a Java project like SnapShot above. Now you've completed the project creation, the foundation for starting the Java project~

Input/Output method

Output method

[flow chart]


As shown in the figure above, the output method is a method of sending a command to the computer to print it to the console. As explained earlier, you need to know the rules to give these commands to your computer, and you can understand them by referring to the snapshot below.

[Type of output method]

1.     System.out.print(value);

2.     System.out.println(value);

3.     System.out.printf(value);

It can be organized into three things as shown in the picture above. To check the difference above, you can refer to the result by pressing Ctrl+f11 to execute the code shown in the snapshot below.

In simple terms, “print” is an output without enter “println” is an output followed by an enter “printf” is a formatted output.

Input Method

So far, we've learned about the output method. Now, let's start explaining the input method.

[flow chart]

This is a method that receives information from the keyboard from the computer, such as the snapshot above.

[practice]

The above snapshot shows four input methods (sc.next(), sc.nextInt(), sc.nextFloat(), and sc.nextLine(). Each feature is that sc.next receives characters that are not recognized after spacing, sc.nextInt() receives integers, sc.nextFloat() receives mistakes, and sc.nextLine receives strings that can be entered until spacing.

So, we learned how to make a project and how to use input/output methods.

Comments