Java: Learning Java_1-Hello World! ver. 1

Last Updated on September 9, 2022 by shibatau

I. Installing Java on Mac

You can learn how to install Java on Mac here:

How to Install Java on MacOS?

II. Hello World in the terminal

1. Creating a sample directory and move there

Run the code in the terminal:

mkdir sample_directory && cd sample_directory

2.Create a hello.java file with Neovim.

Run the code and create a file.

nvim hello.java

Type out the following in the Neovim editor:

public class HelloWorld {

   public static void main(String[] args) {

       System.out.println("Hello World!");

   }

}

If you want to paste the codes from the clipboard, type“+ p in the Neovim editor:

3.Compile the program

Run the command in the terminal:

javac HelloWorld.java 

4.Run HelloWorld

Run the code in the terminal:

java HellowWorld

You can learn more here:

Learn how to code in Java on a Mac

To be continued.

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.