Simple Java program

Simple Java program

YAJC become Java programmer

Let's create a super simple program which only says a welcome message

Simple Java program

Here we do the next:

  • ls - list content of the current directory
  • mkdir - create a directory with the specified name in the current directory
  • cd - change directory to go to the specified directory name
  • vim - is a text editor. Be careful a lot of people find it hard to exit it 😁 Just have a look at this question and pay attention how many votes it has: https://stackoverflow.com/q/11828270
    hint: type ESC and then :wq to enter command mode and w - write, q - quit
  • javac - Java compiler, we use it to convert source code (human readable) into bytecode (Java machine instructions). As a result of the execution we can find Yajc.class file is created - that's the file with bytecode
  • java Yajc - execute program in the current file and specify Yajc as the main class which will be used to start the program

Java code

Let's have some comments for each line we've typed

public class Yajc { // declaration of the main class
public static void main(String[] args) { // entry point for program, it starts execution from this method
System.out.println("Hey YAJC channel!"); // instruction to output specified text to the console output
}
}

In case you have any questions, welcome to the group, we'll try to help you! 😊

Report Page